// A program demonstrating the use of arrays // min, max and bubble sort import java.io.*; import java.util.*; class array { public static void main (String[] args) throws IOException { BufferedReader stdin; stdin = new BufferedReader (new InputStreamReader (System.in)); int [] a = new int [100]; int i, n = 0, min, max; float total = 0; System.out.println ("Type a sequence of numbers separated by blanks or commas:"); StringTokenizer str = new StringTokenizer(stdin.readLine()," ,"); while (str.hasMoreTokens()) { a[n] = Integer.parseInt(str.nextToken()); n = n + 1; } min = a[0]; max = a[0]; for (i = 0; i < n; i++) { if (max < a[i]) max = a[i]; if (min > a[i]) min = a[i]; total = total + a[i]; } System.out.print ("You entered " + n + " numbers: "); System.out.print ("Min = " + min + ", Max = " + max + ", Average = " + total/n); int t, swap = 0; do { swap = 0; for (i=0; ia[i+1]) {t=a[i]; a[i]=a[i+1]; a[i+1]=t; swap++;} } while (swap>0); System.out.print ("\nSorted: "); for (i=0; i