From: Dana Dahlstrom To: cse15L@ucsd.edu Subject: notes X ddahlstr mpartner Dana Dahlstrom and Mysterious Partner Notes X (eXample) $ javac Example.java $ java Example Usage: java Example max $ java Example 0 Maximum prime to look for must be 2 or greater $ java Example 1 Maximum prime to look for must be 2 or greater $ java Example 2 2 $ java Example 3 2 3 $ java Example 4 2 3 4 ---- failure: 4 is not prime began walking through code for max=4 max is passed to PrimeFinder.getPrimes PrimeFinder.getPrimes appears to implement sieve of Eratosthenes no apparent defects in PrimeFinder.getPrimes; FixedSizedBitSet may be at fault ---- $ java Example 8 2 3 4 5 6 7 8 $ java Example 16 2 3 5 7 11 13 $ java Example 12 2 3 5 7 9 11 $ java Example 10 2 3 5 7 9 $ java Example 9 2 3 5 7 9 ---- ...intriguing returned to inspecting code FixedSizedBitSet unary constructor looks OK; add and contain methods are used FixedSizedBitSet.remove is never used the IllegalArgumentExceptions have no detail strings add and contains use a private method, mask the program uses a lot of bitwise operators began walking through the code again, comparing max=9 to max=8 noticed the cast to int on line 59: int stop = (int)Math.sqrt(max); considered adding 1, taking the ceiling instead of the floor noticed the loop termination condition on line 63 contradicts a comment: for(int i=2;i