```
public class Solution {
public void rotate(int[] nums, int k) {
if(k > nums.length) k %= nums.length;
int[] first = new int[k];
System.arraycopy(nums, nums.length-k, first, 0, k);
System.arraycopy(nums, 0, nums, k,nums.length-k);
System.arraycopy(first,0, nums, 0, k );
}
}
```