StrictBitVector implements BitVector { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(bits); return result; } StrictBitVector(byte[] bits);  StrictBitVector(int size);  StrictBitVector(int size, Drbg rand); boolean getBit(int index, boolean isBigEndian); @Override boolean getBit(int bit); void setBit(int index, boolean value, boolean isBigEndian); @Override void setBit(int index, boolean value); @Override int getSize(); @Override byte[] toByteArray(); String asBinaryString(); @Override void xor(BitVector other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static StrictBitVector concat(StrictBitVector... bitVectors);  }
@Test public void testHashCode() { byte[] bits = { (byte) 0xFF, (byte) 0x01, (byte) 0x00 }; StrictBitVector bv = new StrictBitVector(bits); byte[] otherBits = { (byte) 0xFF, (byte) 0x01, (byte) 0x00 }; StrictBitVector otherBv = new StrictBitVector(otherBits); assertEquals(bv.hashCode(), otherBv.hashCode()); assertNotEquals(bv.hashCode(), new StrictBitVector(new byte[]{0x42})); }