01: /* HeapSortClient
02: (C) Copyright 2004 Herbert J. Bernstein
03: All Rights Reserved
04: */
05:
06: // A client to test the HeapSort class
07: // Sorts the arguments on the command line
08:
09:
10: public class HeapSortClient {
11:
12: public static void main (String [] args) {
13: int ii;
14: HeapSort hs;
15: int [] is;
16:
17: hs = new HeapSort();
18: is = new int[args.length];
19:
20: for (ii=0; ii < args.length; ii++) {
21: try {
22: is[ii] = Integer.parseInt(args[ii]);
23: }
24: catch (NumberFormatException e) {
25: }
26: System.out.println("added "+args[ii]);
27: }
28:
29: hs.heapsort(is);
30: for (ii = 0; ii < is.length; ii++) {
31: System.out.println(is[ii]);
32: }
33: return;
34: }
35: }
36:
37:
38:
39: