public class ByteUtils
extends java.lang.Object
| Constructor and Description |
|---|
ByteUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
bytesToInt(byte[] bytes)
Converts an array of 4 bytes into a int.
|
static long |
bytesToLong(byte[] bytes)
Converts an array of 8 bytes into a long.
|
static byte[] |
intToBytes(int x)
Converts an int value into an array of 4 bytes.
|
static int |
isEqualConstantTime(int b,
int c)
Constant-time byte comparison.
|
static int |
isNegativeConstantTime(int b)
Constant-time check if byte is negative.
|
static byte[] |
longToBytes(long x)
Converts a long value into an array of 8 bytes.
|
static java.lang.String |
toString(byte[] bytes)
Creates a human readable representation of an array of bytes.
|
public static long bytesToLong(byte[] bytes)
bytes - The bytes.public static byte[] longToBytes(long x)
x - The long.public static int bytesToInt(byte[] bytes)
bytes - The bytes.public static byte[] intToBytes(int x)
x - The int.public static int isEqualConstantTime(int b,
int c)
b - One byte.c - Another byte.public static int isNegativeConstantTime(int b)
b - The byte to check.public static java.lang.String toString(byte[] bytes)
bytes - The bytes.