RankedBitVectorImpl implements RankedBitVector, Iterable<Boolean> { @Override public long countBits(boolean bit, long position) { return this.countBitsArray.countBits(bit, position); } RankedBitVectorImpl();  RankedBitVectorImpl(BitVector bitVector);  RankedBitVectorImpl(long initialSize);  RankedBitVectorImpl(long initialSize, int countBlockSize,
			int findPositionBlockSize); @Override boolean addBit(boolean bit); @Override long countBits(boolean bit, long position); @Override boolean equals(Object obj); @Override long findPosition(boolean bit, long nOccurrence); @Override boolean getBit(long position); @Override int hashCode(); @Override Iterator<Boolean> iterator(); @Override void setBit(long position, boolean bit); @Override long size(); @Override String toString();  }
@Test public void testCountBits() { final long aLargeNumber = 0x100000; PseudorandomBooleanGenerator generator = new PseudorandomBooleanGenerator( 0x1234); RankedBitVectorImpl bv = new RankedBitVectorImpl(new BitVectorImpl()); for (int i = 0; i < aLargeNumber; i++) { boolean value = generator.getPseudorandomBoolean(); bv.addBit(value); } for (int i = 0; i < aLargeNumber; i++) { if ((i % 0x6785) == 0) { assertCorrectCount(bv, i); } } }