I haven\'t found anything with the specific needs of my function to do this, yes, it is for homework.
So I have:
public void reverseArray(int[] x) {
public class RecursiveArray {
public static int[] backWardArray(int[] arr, int start, int end) {
if (start < end) {
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
backWardArray(arr, start + 1, end - 1);
}
return arr;
}
public static void main(String[] args) {
int [] arr = {12,4,6,8,9,2,1,0};
int [] reversedArray= backWardArray(arr, 0, arr.length-1);
//loop through the reversed array
for (int i: reversedArray) {
System.out.println(i);
}
}
public RecursiveArray() {
}
}