StrictBitVector implements BitVector { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } StrictBitVector other = (StrictBitVector) obj; if (!Arrays.equals(bits, other.bits)) { return false; } return true; } 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 testEquals() { 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); assertTrue(bv.equals(bv)); assertTrue(bv.equals(otherBv)); assertFalse(bv.equals(null)); assertFalse(bv.equals("Not a bit vector")); assertFalse(bv.equals(new StrictBitVector(new byte[]{}))); }