@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullArraysSorting() { moveZeros.moveSorting(null); }
public void moveSorting(int[] array) { validateArray(array); boolean swap = true; while (swap) { swap = false; for (int i = 0; i < array.length - 1; i++) { if ((array[i] < array[i + 1] && array[i + 1] > 0)) { swap(array, i, i + 1); swap = true; } } } }
MoveZerosInArray { public void moveSorting(int[] array) { validateArray(array); boolean swap = true; while (swap) { swap = false; for (int i = 0; i < array.length - 1; i++) { if ((array[i] < array[i + 1] && array[i + 1] > 0)) { swap(array, i, i + 1); swap = true; } } } } }
MoveZerosInArray { public void moveSorting(int[] array) { validateArray(array); boolean swap = true; while (swap) { swap = false; for (int i = 0; i < array.length - 1; i++) { if ((array[i] < array[i + 1] && array[i + 1] > 0)) { swap(array, i, i + 1); swap = true; } } } }  }
MoveZerosInArray { public void moveSorting(int[] array) { validateArray(array); boolean swap = true; while (swap) { swap = false; for (int i = 0; i < array.length - 1; i++) { if ((array[i] < array[i + 1] && array[i + 1] > 0)) { swap(array, i, i + 1); swap = true; } } } }  void moveSorting(int[] array); void moveUsingTwoPointers(int[] array); }
MoveZerosInArray { public void moveSorting(int[] array) { validateArray(array); boolean swap = true; while (swap) { swap = false; for (int i = 0; i < array.length - 1; i++) { if ((array[i] < array[i + 1] && array[i + 1] > 0)) { swap(array, i, i + 1); swap = true; } } } }  void moveSorting(int[] array); void moveUsingTwoPointers(int[] array);  }