/* Array1.java CIS 160 David Klick 2004-11-01 Basic array usage; passing arrays to methods */ public class Array1 { public static void main(String[] args) { int[] num; num = new int[5]; // alternative to above line: // int[] num = new int[5]; initArray(num); System.out.println("Randomized integer array:"); displayArray(num); System.out.println("Minimum value = " + findMin(num)); System.out.println("Maximum value = " + findMax(num)); System.out.println("Sum of array = " + sumArray(num)); System.out.println("\nSorted integer array:"); sortArray(num); displayArray(num); System.out.println("\nCleared integer array:"); clearArray(num); displayArray(num); } private static void initArray(int[] a) { for (int i=0; i max) max = a[i]; } return max; } private static int sumArray(int[] a) { int sum = 0; for (int i=0; i a[j]) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } } } } }