public final class UtilityConversion
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
byteArrayToInt(byte[] bytes)
Convert a byte array to an integer.
|
static short |
byteArrayToShort(byte[] bytes)
Convert a byte array to an integer.
|
static byte |
fromUnsignedByte(short value)
Return the java byte value [-128|127] from an unsigned byte [0|255].
|
static short |
fromUnsignedShort(int value)
Return the java short value [-32768|32767] from an unsigned short [0|65535].
|
static byte[] |
intToByteArray(int value)
Convert an integer to an array of byte.
|
static byte[] |
shortToByteArray(short value)
Convert a short to an array of byte.
|
static short |
toUnsignedByte(byte value)
Return the unsigned byte value [0|255] from the java byte value [-128|127].
|
static int |
toUnsignedShort(short value)
Return the unsigned short value [0|65535] from the java short value [-32768|32767].
|
public static byte[] intToByteArray(int value)
value
- The integer value.public static int byteArrayToInt(byte[] bytes)
bytes
- The byte array.public static byte[] shortToByteArray(short value)
value
- The short value.public static short byteArrayToShort(byte[] bytes)
bytes
- The byte array.public static byte fromUnsignedByte(short value)
value
- The unsigned byte value [0|255].public static short toUnsignedByte(byte value)
value
- The java byte value [-128|127].public static short fromUnsignedShort(int value)
value
- The unsigned short value [0|65535].public static int toUnsignedShort(short value)
value
- The java short value [-32768|32767].