public synchronized int setNextBit ( boolean value ) { increaseLength ( ) ; index = ( index + 1 ) % size ; int previous = bitSet . set ( index , value ) ; int current = value ? 1 : 0 ; cardinality = cardinality - previous + current ; return cardinality ; }
Sets the bit at the next index to the specified value .