0
公共类I5Exc1a {OutofBoundException发送阵列时的方法
public static int[] reverse(int[] array)
{
int[] local = array;
int i = local.length;
int j = 0;
int[] arrayR = new int[i];
for (;i>-1; i--)
{
arrayR[j] = array[i];
j++;
}
return arrayR;
}
}
它应该接收阵列和扭转它。但是当我测试它时,它会给我带来不便。我试着通过制作一个额外的数组来修复它。我认为问题在于数组的长度没有正确传递给i。有谁知道我可以如何解决这个问题?
非常感谢! –