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

{

int n = nums.length;

int[] res = new int[n];

if(k > n)

{

k = k-n;

}

for(int i =0;i<n;i++)

{

if(i+k < n)

{

res[i+k] = nums[i];

}

else

{

res[i+k-n] = nums[i];

}

}

System.out.println(Arrays.toString(res));

}