import java.util.Arrays;

public class BitSet implements IntSet
{
   public boolean test(int n)
   {
      ...
   }

   public void set(int n)
   {
      ...
   }   

   public void clear(int n)
   {
      ...
   }

   public int min()
   {
      ...
   }

   public int max()
   {
      ...
   }

   // Don't change any of these (but add javadoc)
   
   public int size()
   {
      return elementCount;
   }

   private static boolean test(int n, int i)
   {
      assert 0 <= i && i < 32;
      return (n & (1 << i)) != 0;
   }

   private static int set(int n, int i)
   {
      assert 0 <= i && i < 32;
      return n | (1 << i);
   }

   private static int clear(int n, int i)
   {
      assert 0 <= i && i < 32;
      return n & ~(1 << i);
   }

   // These are left package visible so they can be accessed in a unit test

   int[] elements;
   int start;
   int elementCount;
}
