public class BitArray extends Object
Constructor and Description |
---|
BitArray(byte[] array)
Construct a new BitArray using argument as initial values.
|
BitArray(ByteBuffer bb)
Construct a new BitArray holding at least n bits
|
BitArray(int n)
Construct a new BitArray holding at least n bits
|
Modifier and Type | Method and Description |
---|---|
boolean |
get(int i) |
ByteBuffer |
getByteBuffer() |
byte[] |
getBytes() |
void |
set(int i,
boolean value)
set the i'th bit to 1 or 0
|
public BitArray(int n)
n
- number of bits to holdpublic BitArray(byte[] array)
array
- byte array of initial valuespublic BitArray(ByteBuffer bb)
bb
- number of bits to holdpublic byte[] getBytes()
public ByteBuffer getByteBuffer()
public boolean get(int i)
i
- index of bit to testpublic void set(int i, boolean value)
i
- bit number to setvalue
- if true, the bit is set to 1, otherwise it is set to 0Copyright © 2005–2015 IIPC. All rights reserved.