Answer:
Following are the code in the Java Programming Language.
//declare a function
public void reverse(int arr1[]) {
int x; //set integer type variable
//set integer type variable which stores array length
int num = arr1.length;
//set for loop for reversing an array
for (int j = 0; j < arr1.length / 2; j++) {
x = arr1[j];
arr1[j] = arr1[num - j - 1];
arr1[num - j - 1] = x;
}
}
Explanation:
Here, the following code in the Java Programming Language for reversing an array.