public final class Bits extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
clearBit(int value,
int bit)
Clears a bit in an int value.
|
static long |
clearBit(long value,
int bit)
Clears a bit in a long value.
|
static boolean |
isBitSet(int value,
int bit)
Tests whether a bit is set in an int value.
|
static boolean |
isBitSet(long value,
int bit)
Tests whether a bit is set in a long value.
|
static int |
setBit(int value,
int bit)
Sets a bit in an int value.
|
static long |
setBit(long value,
int bit)
Sets a bit in a long value.
|
public static boolean isBitSet(int value,
int bit)
value - The bit field to test.bit - The index of the bit to test, where bit 0 is the LSB.true if the bit is set, false otherwise.public static boolean isBitSet(long value,
int bit)
value - The bit field to test.bit - The index of the bit to test, where bit 0 is the LSB.true if the bit is set, false otherwise.public static int setBit(int value,
int bit)
value - The bit field to modify.bit - The index of the bit to set, where bit 0 is the LSB.public static long setBit(long value,
int bit)
value - The bit field to modify.bit - The index of the bit to set, where bit 0 is the LSB.public static int clearBit(int value,
int bit)
value - The bit field to modify.bit - The index of the bit to clear, where bit 0 is the LSB.public static long clearBit(long value,
int bit)
value - The bit field to modify.bit - The index of the bit to clear, where bit 0 is the LSB.