MoveZeroes { public static void move(int[] array) { if (array == null || array.length == 0) { return; } int p1 = 0, p2 = 0; while (p2 < array.length) { while (p2 < array.length && array[p2] == 0) { p2++; } if (p2 < array.length) { array[p1] = array[p2]; p1++; p2++; } } for (int i = p1; i < array.length; i++) { array[i] = 0; } }  static void move(int[] array);  }
@Test(dataProvider = "intArraies") public void testMoves(int[] original, int[] expected) { MoveZeroes.move((original)); TestUtilities.assertEquals(original, expected); }