public class Solution {

public void rotate(int[] nums, int k) {

if(nums == null)

return;

```
int len = nums.length;
if (k >= len)
return;
int i = 0, j = 0, index = 0;
if (k > len)
k = k % len;
for (i = len - k; i < len; i++) {
j = i;
int temp = nums[i];
while (j > index) {
nums[j] = nums[j - 1];
j--;
}
nums[index++] = temp;
}
}
```

}