public abstract class ByteUtil extends Object
Constructor and Description |
---|
ByteUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
bytesToHexstring(byte[] bytes,
String delimiter) |
static long |
bytesToUnsignedInt(byte[] bytes)
Converts a 4 byte array of unsigned bytes to unsigned int
|
static long |
bytesToUnsignedMedium(byte[] bytes)
Converts a 3 byte array of unsigned bytes to unsigned int
|
static int |
bytesToUnsignedShort(byte[] bytes)
Converts a 2 byte array of unsigned bytes to unsigned short
|
static byte[] |
convertBigIntegerToNBytes(BigInteger bigInteger,
int numBytes)
Utility method to convert BigInteger to n element byte array
|
static byte[] |
unsignedIntToBytes(Long unsignedInt)
Converts unsigned integer to a 4 byte array of unsigned bytes
|
static byte[] |
unsignedMediumToBytes(Long unsignedInt)
Converts unsigned integer to a 3 byte array of unsigned bytes
|
static byte[] |
unsignedShortToBytes(Integer unsignedShort)
Converts unsigned short to a 2 byte array of unsigned bytes
|
public static String bytesToHexstring(byte[] bytes, String delimiter)
bytes
- bytes that needs to be converted to hexdelimiter
- string delimiterpublic static byte[] convertBigIntegerToNBytes(BigInteger bigInteger, int numBytes)
bigInteger
- big integer value that needs to be converted to bytenumBytes
- convert to number of bytespublic static final long bytesToUnsignedInt(byte[] bytes)
bytes
- an array of 4 unsigned bytespublic static final long bytesToUnsignedMedium(byte[] bytes)
bytes
- an array of 4 unsigned bytespublic static final int bytesToUnsignedShort(byte[] bytes)
bytes
- an array of 2 unsigned bytespublic static byte[] unsignedIntToBytes(Long unsignedInt)
unsignedInt
- representing the unsigned integerpublic static byte[] unsignedMediumToBytes(Long unsignedInt)
unsignedInt
- representing the unsigned integerpublic static byte[] unsignedShortToBytes(Integer unsignedShort)
unsignedShort
- representing the unsigned shortCopyright © 2018 OpenDaylight. All rights reserved.