### Question:
Rotate { public void rotate4(int[] nums, int k) { k = k % nums.length; int count = 0; for (int start = 0; count < nums.length; start++) { int current = start; int prev = nums[start]; do { int next = (current + k) % nums.length; int temp = nums[next]; nums[next] = prev; prev = temp; current = next; count++; } while (start != current); } }  void rotate(int[] nums, int k); void rotate(int[] nums); void rotate2(int[] nums, int k); void rotate3(int[] nums, int k); void rotate4(int[] nums, int k); void rotate5(int[] nums, int k); void reverse(int[] nums, int start, int end);  }### Answer:
@Test void go4(){ Rotate rotate = new Rotate(); for (int i = 0; i < cases.size(); i++) { rotate.rotate4(cases.get(i),caseNums.get(i)); assertArrayEquals(results.get(i), cases.get(i)); } }