BitSet { public void set(int index) { Preconditions.checkArgument(index < bitLength && index >= 0); int byteIndex = (index & BYTE_POSITION_MASK) >>> 3; byte current = memorySegment.get(offset + byteIndex); current |= (1 << (index & BYTE_INDEX_MASK)); memorySegment.put(offset + byteIndex, current); } BitSet(int byteSize); void setMemorySegment(MemorySegment memorySegment, int offset); void set(int index); boolean get(int index); int bitSize(); void clear(); @Override String toString();  }
@Test(expected = IllegalArgumentException.class) public void verifyInputIndex1() { bitSet.set(8 * byteSize + 1); }
@Test(expected = IllegalArgumentException.class) public void verifyInputIndex2() { bitSet.set(-1); }