public void setBit ( int index , boolean set ) { assertValidIndex ( index ) ; int word = index / WORD_LENGTH ; int offset = index % WORD_LENGTH ; if ( set ) { data [ word ] |= ( 1 << offset ) ; } else // Unset the bit. { data [ word ] &= ~ ( 1 << offset ) ; } }
Sets the bit at the specified index .