public final class BytesHelper extends Object
Modifier and Type | Method and Description |
---|---|
static long |
asLong(byte[] bytes)
Interpret the binary representation of a long.
|
static long |
asLong(byte[] bytes,
int srcPos)
Interpret the binary representation of a long.
|
static byte[] |
fromInt(int intValue)
Interpret an int as its binary form
|
static byte[] |
fromLong(long longValue)
Interpret a long as its binary form
|
static void |
fromLong(long longValue,
byte[] dest,
int destPos)
Interpret a long as its binary form
|
static byte[] |
fromShort(int shortValue)
Interpret a short as its binary form
|
static String |
toBinaryString(byte value) |
static String |
toBinaryString(int value) |
static String |
toBinaryString(long value) |
static int |
toInt(byte[] bytes)
Custom algorithm used to generate an int from a series of bytes.
|
public static int toInt(byte[] bytes)
bytes
- The bytes to use in generating the int.public static byte[] fromShort(int shortValue)
shortValue
- The short to interpret to binarypublic static byte[] fromInt(int intValue)
intValue
- The int to interpret to binarypublic static byte[] fromLong(long longValue)
longValue
- The long to interpret to binarypublic static void fromLong(long longValue, byte[] dest, int destPos)
longValue
- The long to interpret to binarydest
- the destination array.destPos
- starting position in the destination array.public static long asLong(byte[] bytes)
bytes
- The bytes to interpret.public static long asLong(byte[] bytes, int srcPos)
bytes
- The bytes to interpret.srcPos
- starting position in the source array.public static String toBinaryString(byte value)
public static String toBinaryString(int value)
public static String toBinaryString(long value)
Copyright © 2019 JBoss by Red Hat. All rights reserved.