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 ) ; }
Sets the bit at specified index .