public class BitUtil extends Object
Constructor and Description |
---|
BitUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean[] |
asBools(byte[] bytes) |
static byte[] |
clear(byte[] bytes,
int position)
Clear the bit at the specified position
|
static int |
count(byte[] bytes) |
static boolean |
get(byte[] bytes,
int position)
Check to see if the specified bit is set
|
static String |
prettyPrint(byte[] bytes) |
static byte[] |
set(byte[] bytes,
int position)
Set the bit at the specified position
|
public static boolean[] asBools(byte[] bytes)
public static byte[] clear(byte[] bytes, int position)
bytes
- the byte arrayposition
- the bit to clear, starting from zeroIndexOutOfBoundsException
- on bad positionpublic static int count(byte[] bytes)
bytes
- public static boolean get(byte[] bytes, int position)
bytes
- the byte arrayposition
- the bit to check, starting from zeroIndexOutOfBoundsException
- on bad positionpublic static String prettyPrint(byte[] bytes)
bytes
- public static byte[] set(byte[] bytes, int position)
bytes
- the byte arrayposition
- the bit to set, starting from zeroIndexOutOfBoundsException
- on bad positionCopyright © 2003–2022 UBC Michael Smith Laboratories. All rights reserved.