我对java很陌生,请检查下面的代码。请告诉我哪里错了
提前致谢
导入java.io.*;
导入 java.util.*;
公共类解决方案{
public void rotate(int[] nums, int k) {
k %= nums.length;
reverse(nums, 0, nums.length - 1);
reverse(nums, 0, k - 1);
reverse(nums, k, nums.length - 1);
}
public void reverse(int[] nums, int start, int end) {
while (start < end) {
int temp = nums[start];
nums[start] = nums[end];
nums[end] = temp;
start++;
end--;
}
for(int j = 0 ; j < nums.length - 1 ; j++ )
{
System.out.print(nums[j] + " ");
}
}
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int size = in.nextInt();
int n = in.nextInt();
int[] nums = new int[size];
for(int i = 0; i<nums.lenght-1;i++)
{
nums[i] = scan.nextInt();
}
rotate(nums, n);
}
}