```
publicvoid rotate(int[] nums, int k) {
if(nums.length<k) k%=nums.length;
int[] temp=new int[nums.length];
for(int i=0;i<k;i++)
temp[i]=nums[nums.length-k+i];
for(int i=k;i<nums.length;i++)
temp[i]=nums[i-k];
}
```

System says Input set as "[1,2], 1" and the result was [1,2], while I runned myeclipese I got [2,1], where is the problem occurs?