|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.spy.util.BitArray
An array of bits. The initial version of this is not intended to be efficient.
| Constructor Summary | |
BitArray()
Get an intance of BitArray. |
|
BitArray(int size)
Get an instance of BitArray with storage for a given number of bits. |
|
BitArray(String bitString)
Get a BitArray by parsing a string. |
|
| Method Summary | |
void |
add(boolean value)
Add a bit. |
void |
addBits(int bitSet,
int numBits)
Add a set of bits from an integer. |
int |
getBits(int from,
int number)
Get a given number of bits from a given offset. |
int |
getLSBBits(int numBits)
Get a given number of the least significant bits. |
int |
getMSBBits(int numBits)
Get a given number of the most significant bits. |
void |
removeBits(int from,
int howMany)
Remove a specific number of bits from a specific location. |
void |
removeLSBBits(int howMany)
Remove a give number of bits from the LSB side. |
void |
removeMSBBits(int howMany)
Remove a give number of bits from the MSB side. |
int |
size()
Get the number of bits remaining in the bit set. |
String |
toString()
String me. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public BitArray(int size)
public BitArray()
public BitArray(String bitString)
bitString - the string containing zeros and ones| Method Detail |
public void add(boolean value)
value - if true, add a one bit.
public void addBits(int bitSet,
int numBits)
bitSet - the integer containing the bitsnumBits - the number of bits to add.public void removeMSBBits(int howMany)
howMany - bits to removepublic void removeLSBBits(int howMany)
howMany - bits to remove
public void removeBits(int from,
int howMany)
from - starting pointhowMany - number of bits to remove.
public int getBits(int from,
int number)
from - starting offset (from MSB side).number - number of bits to retrieve
IllegalArgumentException - if number > 32
IndexOutOfBoundsException - if the bit range would specify
bits we don't havepublic int getMSBBits(int numBits)
numBits - number of bits to get
IllegalArgumentException - if numBits greater than 31 or
the number of bits remaining in the bit listpublic int getLSBBits(int numBits)
numBits - number of bits to get
IllegalArgumentException - if numBits greater than 31 or
the number of bits remaining in the bit listpublic int size()
public String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||