public class Bits
extends java.lang.Object
Constructor and Description |
---|
Bits() |
Modifier and Type | Method and Description |
---|---|
static int |
clearBit(int n,
int pos)
Sets the bit at the specified position to false.
|
static int |
setBit(int n,
int pos)
Sets the bit at the specified position to true.
|
static boolean |
testBit(int n,
int pos)
Tests if the bit at the specified position is true.
|
public static int setBit(int n, int pos)
n
- The bit coded integer valuepos
- The bit position to be set truepublic static int clearBit(int n, int pos)
n
- The bit coded integer valuepos
- The bit position to be set falsepublic static boolean testBit(int n, int pos)
n
- The bit coded integer valuepos
- The bit position to be set false