I'm running into a little trouble understanding how I can initialize an array with the values that are listed in the notes. How would I be able to set up array and proceed to use the code below to properly return the respective output.
This question varies from the duplicate linked because it is asking how to initialize the array within a local method.
/*Write a method that reverses the sequence of elements in an array. For example, if
you call the method with the array
1 4 9 16 9 7 4 9 11
then the array is changed to
11 9 4 7 9 16 9 4 1*/
public static void reverse(int[] array) {
for (int i = 0; i < array.length / 2; i++) {
int temp = array[i];
array[i] = array[array.length - 1 - i];
array[array.length - 1 - i] = temp;
}
}