class Arrays { public static void main(String[] args) { int a[] = new int[6]; /* Populates array 'a' with nonnegative random integers < 100. */ for (int i = 0; i < a.length; i++) a[i] = (int)(Math.random() * 100); /* Prints all elements of array 'a' */ for (int i = 0; i < a.length; i++) System.out.println(a[i]); /* This loop computes both the minimum and maximum of array 'a' */ int maxValue = Integer.MIN_VALUE; int minValue = Integer.MAX_VALUE; for (int i = 0; i < a.length; i++) { maxValue = Math.max(maxValue, a[i]); minValue = Math.min(minValue, a[i]); } System.out.println("The max value is " + maxValue); System.out.println("The min value is " + minValue); /* This loop reverses elements of array 'a' */ for (int i = 0, j = a.length - 1; i < j; i++, j--) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } for (int i = 0; i < a.length; i++) System.out.println(a[i]); } }