public class BitSet
extends java.lang.Object
Constructor and Description |
---|
BitSet()
Initializes the new instance with the default value 0.
|
BitSet(int initialValue)
Initializes the new instance with the given value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Returns true, if the given arguments equals the receiver.
|
protected int |
getBits() |
int |
getValue()
Returns the byte value, that is the combination of the 8 bits.
|
int |
hashCode()
Returns the receiver's hash value.
|
boolean |
isBitNotSet(int bit)
Returns true, if the bit defined by the argument is not set.
|
boolean |
isBitSet(int bit)
Returns true, if the bit defined by the argument is set.
|
void |
setBit(int bit)
Sets the bit defined by the argument.
|
protected void |
setBits(int newValue) |
void |
toggleBit(int bit)
Switches a set bit to unset and a unset bit to set.
|
java.lang.String |
toString()
Returns the string representation of the receiver.
|
void |
unsetBit(int bit)
Unsets the bit defined by the argument.
|
public BitSet()
public BitSet(int initialValue)
public int getValue()
public boolean isBitSet(int bit)
bit
- The bit to test ( 0 - 7 )public boolean isBitNotSet(int bit)
bit
- The bit to test ( 0 - 7 )public void setBit(int bit)
bit
- The bit to manipulate ( 0 - 7 )public void unsetBit(int bit)
bit
- The bit to manipulate ( 0 - 7 )public void toggleBit(int bit)
bit
- The bit to toggle ( 0 - 7 )public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected int getBits()
protected void setBits(int newValue)