code: public static void main(String[] args) {
          java.util.Random r = new java.util.Random();
          Bits bits = new Bits();
          for (int i=0; i<125; i++) {
              int k;
              do {
                  k = r.nextInt(250);
              } while (bits.isMember(k));
              System.out.println("adding " + k);
              bits.incl(k);
          }
          int count = 0;
          for (int i = bits.nextBit(0); i >= 0; i = bits.nextBit(i+1)) {
              System.out.println("found " + i);
              count ++;
          }
          if (count != 125) {
              throw new Error();
          }
      }
docs: Test Bits.nextBit(int).