Active Visual Scaffolding by Charles Kelemen and Eugene Turk
/* Program to test sort */
public static void main(String argv[]) {
if (argv.length != 1) {
System.out.println("usage: sort array-size");
System.exit(1);
}
int size = Integer.parseInt(argv[0]);
int test[] = new int[size];
Random r = new Random();
for (int i = 0; i < size; i++)
test[i] = (int)(r.nextFloat() * 100);
System.out.println("initial random numbers");
for (int i = 0; i < size; i++)
System.out.print(" " + test[i]);
System.out.println();
sort(test, size);
System.out.println("after sorting");
for (int i = 0; i < size; i++)
System.out.print("\n\n " + test[i]);
System.out.println();
System.exit(0);
}
}
To pvwtalk13