public final class BitArray
extends java.lang.Object
BitSet.| Constructor and Description |
|---|
BitArray()
Construct a new bit array.
|
BitArray(int n)
Construct a new bit array with the specified number of bits.
|
BitArray(long[] a,
int l)
Construct a new bit array with the specified backing array.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear(int i)
Set the ith bit to 0.
|
boolean |
get(int i)
Get the value of the ith bit.
|
boolean |
getAll()
Are all bits set?
|
void |
init()
Initialize the bit array with an empty array.
|
int |
nextClearBit(int i)
Get the next bit set to 0, starting from the ith bit.
|
void |
set(int i)
Set the ith bit to 1.
|
void |
setAll()
Set all bits.
|
void |
setWords(long[] a,
int l)
Initialize the bit array with the specified backing array.
|
long[] |
toArray()
The word array used to store the bits.
|
public BitArray()
public BitArray(int n)
n - initial number of bits (> 0)public BitArray(long[] a,
int l)
a - array with bitsl - number of used bitspublic void init()
public void setWords(long[] a,
int l)
a - array with bitsl - number of used bitspublic long[] toArray()
public boolean get(int i)
i - index of the bittrue if the ith bit is setpublic void set(int i)
i - index of the bitpublic void setAll()
public boolean getAll()
public void clear(int i)
i - index of the bitpublic int nextClearBit(int i)
i - index from which to start the search (inclusive)