public class HexUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
byteArrayToHexString(byte[] value)
Converts the given byte array into a hex string.
|
static int |
byteArrayToInt(byte[] b)
Converts the given byte array (4 bytes length max) into an
integer.
|
static int |
byteArrayToInt(byte[] b,
int length)
Converts any byte array in an integer.
|
static int |
byteArrayToInt(byte[] b,
int length,
int offset)
Converts any byte array in an integer.
|
static java.lang.String |
byteArrayToString(byte[] value)
Converts the given string byte array into a string.
|
static int |
byteToInt(byte b)
Converts the given byte into a integer.
|
static byte[] |
hexStringToByteArray(java.lang.String value)
Converts the given hex string into a byte array.
|
static byte[] |
intToByteArray(int value)
Converts the given integer into a byte array.
|
static java.lang.String |
intToIp(int i)
Converts the given integer into a well formed IP string.
|
static byte[] |
longTo4ByteArray(long value)
Converts a long value to a 4-byte-array-length array .
|
static byte[] |
longToByteArray(long value)
Converts a long value to a 8-byte-array-length array .
|
static byte[] |
shortToByteArray(short value)
Converts the given short into a byte array.
|
static byte[] |
stringToByteArray(java.lang.String value)
Converts the given string into a byte array.
|
public static java.lang.String byteArrayToHexString(byte[] value)
value
- Byte array to convert to hex string.public static int byteArrayToInt(byte[] b)
b
- Byte array to convert to integer (4 bytes length max).public static int byteArrayToInt(byte[] b, int length)
b
- Byte array to convert to integer.length
- Length of the bytes to convert in the byte array.public static int byteArrayToInt(byte[] b, int length, int offset)
b
- Byte array to convert to integer.length
- Length of the bytes to convert in the byte array.offset
- Offset to start reading bytes in the byte array.public static java.lang.String byteArrayToString(byte[] value)
value
- Byte array to convert to string.public static int byteToInt(byte b)
b
- Byte to convert to.public static byte[] hexStringToByteArray(java.lang.String value)
value
- Hex string to convert to.public static byte[] intToByteArray(int value)
value
- Integer to convert to.public static java.lang.String intToIp(int i)
i
- Integer to convert.public static byte[] longTo4ByteArray(long value)
value
- Long value to convert.public static byte[] longToByteArray(long value)
value
- Long value to convert.public static byte[] shortToByteArray(short value)
value
- Short to convert to.public static byte[] stringToByteArray(java.lang.String value)
value
- String to convert to.© Copyright 2014 Etherios, Inc. All rights reserved. Etherios, Inc. is a Division of Digi International Inc.