Answer:
import java.util.Arrays;
public class num11 {
public static void main(String[] args)
{
int [] originalArray = {10, 15, 5, 25, 0};
System.out.println("Original Arrays is: "+Arrays.toString(originalArray));
reverseArray(originalArray, originalArray.length);
}
//Method reverseArray
public static void reverseArray(int a[], int n)
{
int[] newArray = new int[n];
int m = n;
for (int i = 0; i < n; i++) {
newArray[m - 1] = a[i];
m--;
}
#Printing the Reverse
System.out.println("The Reversed Array is "+Arrays.toString(newArray));
}
}
Explanation:
Using Java programming language:
The method is created to accept two parameters (an array and its size)
Create a new array within the method int[] newArray = new int[n];
Using a for loop iterate over the original array and place each of its elements in the new array from the last index, this places the elements reversively.
Use Java's toString() to display the revesered Array