Similarly, write a method reverseArray (also same type) which returns an array of that length with the numbers from 1 to n in reverse order. So, reverseArray(5} should return an array containing {5,4,3,2,1}. code example
Example: reverse array in java
int length = array.length;
for(int i=0;i<length/2;i++) {
int swap = array[i];
array[i] = array[length-i-1];
array[length-i-1] = swap;
}
or
Collections.reverse(Arrays.asList(array));