public class BitSet32 extends java.lang.Object implements BitSetInterface
| Constructor and Description |
|---|
BitSet32(int bitsSize)
Constructs a BitSet large enough to hold numBits.
|
BitSet32(int[] bits,
int bitsSize)
Constructs a BitSet, from an array already initialized
|
| Modifier and Type | Method and Description |
|---|---|
int |
bitSize()
Returns the size in term of bits
|
void |
clear(int index)
Clears a bit.
|
boolean |
get(int index) |
int |
getBit(int index)
Returns 1 if the bit is set, 0 if not.
|
void |
set(int index) |
int |
size()
Returns the size of the bitset (number of words)
|
byte[] |
toByteArray()
Return an array of bytes storing the whole bit set
|
java.lang.String |
toString() |
public BitSet32(int bitsSize)
numBits - number of bitspublic BitSet32(int[] bits,
int bitsSize)
numBits - number of bitsbits - an array of integers storing the BitSetpublic int size()
size in interface BitSetInterfacepublic int bitSize()
bitSize in interface BitSetInterfacepublic boolean get(int index)
get in interface BitSetInterfacepublic int getBit(int index)
getBit in interface BitSetInterfacepublic void set(int index)
set in interface BitSetInterfacepublic void clear(int index)
clear in interface BitSetInterfacepublic byte[] toByteArray()
Remark: the array of bytes is of size 4*W, where W is the number of words storing the bit set which is: size(bit set)/32
public java.lang.String toString()
toString in class java.lang.Object