/** Tester.java - See if the sorting algorithms were implemented correctly. */ public class Tester { public static void main(String [] args) { int [] sample = { 2, 9, 6, 1, 3 }; Array a = new Array(sample); Array b = new Array(sample); Array c = new Array(sample); Array d = new Array(sample); // Call the sorting algorithms. Take note of the times. long t0 = System.currentTimeMillis(); a.selectionSort(); long t1 = System.currentTimeMillis(); b.insertionSort(); long t2 = System.currentTimeMillis(); c.bubbleSort(); long t3 = System.currentTimeMillis(); d.swapSort(); long t4 = System.currentTimeMillis(); System.out.printf("Selection %s %d ms\n", a.toString(), t1 - t0); System.out.printf("Insertion %s %d ms\n", b.toString(), t2 - t1); System.out.printf("Bubble %s %d ms\n", c.toString(), t3 - t2); System.out.printf("Swap %s %d ms\n", d.toString(), t4 - t3); } }