public class Bits extends Object
Constructor and Description |
---|
Bits() |
Modifier and Type | Method and Description |
---|---|
static boolean |
get(byte bits,
int i)
Get a bit from inside a byte.
|
static byte |
mask(byte bits,
int... m)
Get a new byte, masking off all but the bits specified by m.
|
static byte |
set(byte bits,
int i,
boolean bit)
Set a bit inside a byte.
|
static String |
toString(byte bits)
Useful for debugging.
|
public static byte set(byte bits, int i, boolean bit)
bits
- the original bytei
- the bit index (0 through 7)bit
- the bit valuepublic static boolean get(byte bits, int i)
bits
- the bytei
- the bit index (0 through 7)public static byte mask(byte bits, int... m)
bits
- the original bytem
- the bits to keep, all others will be maskedpublic static String toString(byte bits)
bits
- the byteCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.