StrictBitVector implements BitVector { private void rangeCheck(int bit) { if (bit < 0 || bit >= this.size) { throw new IndexOutOfBoundsException("Index out of bounds"); } } 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(expected = IndexOutOfBoundsException.class) public void testRangeCheck() { byte[] bits = { (byte) 0xFF, (byte) 0x01, (byte) 0x00 }; StrictBitVector bv = new StrictBitVector(bits); bv.getBit(2000); }