Professional Documents
Culture Documents
Public Static Int FindZero
Public Static Int FindZero
public class ArrayManipulation { public int findZero (int array[], int pos) { for (; pos < array.length; pos++) if (array[pos] == 0) return pos; return -1; } public int[] setZeros (int array[]) { int start = findZero(array, 0); int end = findZero(array, start + 1); for (; start < end; start++) array[start] = 0; return array; } }
..