removeZeros
Category: Arrays
Author: Stuart Reges
Book Chapter: 7.4
Problem: removeZeros
Write a static method removeZeros that takes an array of integers as a parameter and that moves any zeros in the array to the end of the array, otherwise preserving the order of the list. For example, if a variable called "list" stores the following values: (7, 2, 3, 0, 4, 6, 0, 0, 13, 0, 78, 0, 0, 19, 14) then the call: removeZeros(list); should rearrange the values in the array so that it stores the following: (7, 2, 3, 4, 6, 13, 78, 19, 14, 0, 0, 0, 0, 0, 0) Notice that the six zeros have been moved to the end of the array and the other values are in the same order as in the original list. You are not allowed to use an auxiliary data structure such as a temporary array or ArrayList to solve this problem. You can, however, receive 10 of 15 points if you solve the problem using such a structure. Write your solution to removeZeros below.