WiggleSort { public void wiggleSort(int[] nums) { Arrays.sort(nums); for (int i = 1; i < nums.length; i += 2) { if (i + 1 < nums.length) { int t = nums[i]; nums[i] = nums[i + 1]; nums[i + 1] = t; } } }  void wiggleSort(int[] nums); void wiggleSortN(int[] nums);  }
@Test(dataProvider = "wiggleSortArray") public void testWiggleSort(int[] nums) { new WiggleSort().wiggleSort(nums); assertTrue(wiggleSorted(nums)); }