class GenericSort { public static void sort(Comparable[] A) { for(int i = 0; i < A.length; i++) { for(int j = i+1; j < A.length; j++) { if(A[j].compareTo(A[i]) < 0) { Comparable temp = A[j]; A[j] = A[i]; A[i] = temp; } } // End for(j) } // End for(i) } public static void main(String[] args) { Integer[] A = {new Integer(8), new Integer(1), new Integer(7)}; sort(A); for(int i = 0; i < A.length; i++) { System.out.print(" "+A[i].toString()+","); } System.out.println(); sort(args); for(int i = 0; i < args.length; i++) { System.out.print(" "+args[i]+","); } System.out.println(); } // End main() } // End class GenericSort