```
public class Solution {
public void rotate(int[] nums, int k) {
int n = nums.length;
if(n == 0) return;
k = k % n;
if(k == 0) return;
int[] rux = new int[n];
for(int i = 0,j = n - k; j < n; i++,j++){
rux[i] = nums[j];
}
for(int i = k, j = 0; j < n - k ;i++,j++){
rux[i] = nums[j];
}
for(int i = 0; i < n; i++){
nums[i] = rux[i];
}
}
}
```