public class TableDriver { public static void main( String[] args ) { int num_of_trials = Integer.parseInt(args[0]); int max_power = 1; if (args.length > 1) max_power = Integer.parseInt(args[1]); Experiment ex = new Experiment(); Greedy g = new Greedy(); Zoomin z = new Zoomin(); int trials_this_pass = num_of_trials; System.out.println( "Trials -- Greedy -- Zoomin" ); System.out.println( "--------------------------" ); for (int i = 0; i < max_power; i++) { double g_first = ex.experiment(g, z, trials_this_pass); double z_first = ex.experiment(z, g, trials_this_pass); String filler = spaces(trials_this_pass, num_of_trials, max_power); System.out.print ( filler + trials_this_pass ); System.out.print ( " " + g_first ); System.out.println( " " + z_first ); trials_this_pass *= num_of_trials; } } public static String spaces(int current, int base, int exponent) { int largest = (int) Math.pow(base, exponent); int spaces_max = String.valueOf(largest).length(); int spaces_this = String.valueOf(current).length(); int spaces_fill = spaces_max - spaces_this; return new String(new char[spaces_fill]).replace('\0', ' '); } }