This is what I need to do
Ability to reverse the contents of a single dimensional array of variable size, without using another temporary array.
Given a single dimensional array of integers, numbers, write the Java code to reverse the contents of numbers in-place without using a temporary array to store the reversed contents.
For example, if numbers is {12, 34, 50, 67, 88}, provide code that will alter numbers so that its contents now become {88, 67, 50, 34, 12}.
This is what I have
it is not working correctly.
public static int[] reverseArrayWithoutTempArray(int[] array) {
double array [ ];
array = new double [10];
int [ ] num = {12, 34, 50, 67, 88};
int i = 0;
int j = a.length - 1;
for (i = 0; i < a.length / 2; i++, j—){
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
return array;
}
It actually is working correctly for the example you provided. This is how my code looks like: