SimpleBitSet { public boolean hasSetBits() { boolean anyBitsSet = false; for (int i = 0; i < numWords; i++) { anyBitsSet = anyBitsSet || (words[i] != 0); if (anyBitsSet) { break; } } return anyBitsSet; } SimpleBitSet(int nBits); void set(int index); void unset(int index); int cardinality(); boolean hasSetBits();  }
@Test public void testHasSetBits() { bitSet.set(10); Assert.assertEquals(true, bitSet.hasSetBits()); bitSet.unset(10); Assert.assertEquals(false, bitSet.hasSetBits()); }