```
public static void rotate(int[] nums, int k){
int[] result=new int[nums.length];
for(int i=0;i<nums.length;i++){
result[(i+k) % nums.length] = nums[i];// This line is pretty confused why we need i+k and % nums.length , does some one can help me explain more specific ? Thank you so much
}
for(int i=0;i<nums.length;++i){
nums[i]=result[i];
System.out.print(nums[i]);
}
}
```