public class I5Exc1a {
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;
}
}
It is supposed to receive an array and reverse it. but it gives me outofboundexeption when im testing it. I tried fixing it by making an extra array. I think the problem lies in the fact that the length of the array is not passed on correctly to i. Does anyone know how i can solve this?