BitVectorImpl implements BitVector, Iterable<Boolean> { static String wordToString(long word) { String binaryDigits = String.format("%" + WORD_SIZE + "s", Long.toBinaryString(word)).replace(' ', '0'); return (new StringBuilder(binaryDigits)).reverse().toString(); } BitVectorImpl();  BitVectorImpl(BitVector bitVector);  BitVectorImpl(long initialSize); @Override boolean addBit(boolean bit); @Override boolean equals(Object obj); @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 testWordToString() { long word = 0; Assert.assertEquals( "0000000000000000000000000000000000000000000000000000000000000000", BitVectorImpl.wordToString(word)); word = -1; Assert.assertEquals( "1111111111111111111111111111111111111111111111111111111111111111", BitVectorImpl.wordToString(word)); word = 0x362; Assert.assertEquals( "0100011011000000000000000000000000000000000000000000000000000000", BitVectorImpl.wordToString(word)); }