public final class BitField extends Object
Modifier and Type | Method and Description |
---|---|
void |
clear(int i)
Set bit at the given index to 'false'.
|
boolean |
get(int i)
Get the bit at the given index.
|
int |
getByte(int i)
Get the next 8 bits at the given index.
|
int |
length()
Get the index of the highest set bit plus one, or 0 if no bits are set.
|
int |
nextClearBit(int fromIndex)
Get the index of the next bit that is not set.
|
void |
set(int i)
Set bit at the given index to 'true'.
|
void |
set(int fromIndex,
int toIndex,
boolean value)
Enable or disable a number of bits.
|
void |
setByte(int i,
int x)
Combine the next 8 bits at the given index with OR.
|
public int nextClearBit(int fromIndex)
fromIndex
- where to start searchingpublic boolean get(int i)
i
- the indexpublic int getByte(int i)
i
- the indexpublic void setByte(int i, int x)
i
- the indexx
- the next 8 bits (0 - 255)public void set(int i)
i
- the indexpublic void clear(int i)
i
- the indexpublic void set(int fromIndex, int toIndex, boolean value)
fromIndex
- the index of the first bit to enable or disabletoIndex
- one plus the index of the last bit to enable or disablevalue
- the new valuepublic int length()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.