public class BitSet
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private int |
bits
number of bits in the set
|
private int[] |
data
data array
|
Constructor and Description |
---|
BitSet()
Default ctor creates a bit set of size 64.
|
BitSet(int bits)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isSet(int bit)
Checks bit state.
|
void |
set(int bit)
Turns a bit on.
|
void |
set(int bit,
boolean state)
Sets a bit to the provided value.
|
int |
size()
Returns the bit set size.
|
void |
unset(int bit)
Turns a bit off.
|
public BitSet()
public BitSet(int bits)
bits
- The desired set size.public void set(int bit, boolean state)
bit
- Bit index.state
- New bit state.public void set(int bit)
bit
- Bit index.public void unset(int bit)
bit
- Bit index.public boolean isSet(int bit)
bit
- Bit index.true
if the bit is set, false
otherwisepublic int size()