BitField

A list of bits.

Methods
void clear(int i)
Set bit at the given index to 'false'.
void clear(int i)
Set bit at the given index to 'false'.
Parameters:
i - the index
boolean get(int i)
Get the bit at the given index.
boolean get(int i)
Get the bit at the given index.
Parameters:
i - the index
Returns:
true if the bit is enabled
int getByte(int i)
Get the next 8 bits at the given index.
int getByte(int i)
Get the next 8 bits at the given index. The index must be a multiple of 8.
Parameters:
i - the index
Returns:
the next 8 bits
int length()
Get the index of the highest set bit plus one, or 0 if no bits are set.
int length()
Get the index of the highest set bit plus one, or 0 if no bits are set.
Returns:
the length of the bit field
int nextClearBit(int fromIndex)
Get the index of the next bit that is not set.
int nextClearBit(int fromIndex)
Get the index of the next bit that is not set.
Parameters:
fromIndex - where to start searching
Returns:
the index of the next disabled bit
void set(int i)
Set bit at the given index to 'true'.
void set(int i)
Set bit at the given index to 'true'.
Parameters:
i - the index
void set(int fromIndex, int toIndex, boolean value)
Enable or disable a number of bits.
void set(int fromIndex, int toIndex, boolean value)
Enable or disable a number of bits.
Parameters:
fromIndex - the index of the first bit to enable or disable
toIndex - one plus the index of the last bit to enable or disable
value - the new value
void setByte(int i, int x)
Combine the next 8 bits at the given index with OR.
void setByte(int i, int x)
Combine the next 8 bits at the given index with OR. The index must be a multiple of 8.
Parameters:
i - the index
x - the next 8 bits (0 - 255)