Write code that creates and populates an array of size 25 with random numbers between 1-50.
Display the array contents from the first to last element.
Display the array from the last to the first element.
I am learning how to program from a book. There is only one example of reversing, but it is not an array. I am able to print the first array, but not the second reversed array. It is reversed, but it is not in array form.
import java.util.*;
public class flip
{
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
int[] rn = new int[25];
Random r = new Random();;
for(int i = 0; i < 25; i++)
{
rn[i] = r.nextInt(50) + 1;
}
System.out.println(Arrays.toString(rn));
for(int i = 24; i >= 0; i--)
{
System.out.println(rn[i]);
}
}
}