// Source code example for "A Practical Introduction // to Data Structures and Algorithm Analysis" // by Clifford A. Shaffer, Prentice Hall, 1998. // Copyright 1998 by Clifford A. Shaffer import java.io.*; // Timing test for 32 flags: boolean type class Flagb { // Main routine: Flag test driver public static void main(String args[]) throws IOException { Assert.notFalse(args.length == 1, "Usage: Flagb "); int size = Integer.parseInt(args[0]); boolean dum; boolean[] A = new boolean[32]; long time1 = System.currentTimeMillis(); // Its pretty tricky to get a good timing test on something // that runs so quickly. We must run it a lot of times, // and keep the loop overhead to an absolute minimum. // Note that the assignments are rolled out, instead // of using a double loop, avoiding one source of overhead. for (int i=0; i