The package name of this class is hubitat.helper, so to use in an app or driver you would reference it with hubitat.helper.HexUtils.
Convert integer value to hex string.
String integerToHexString(int value, int minBytes)
value - the integer value to encode
minBytes - the minimum number of hex encoded bytes, must be greater than 0
String - The value of the integer encoded as a hex string.
int i = 5
def hexStr = hubitat.helper.HexUtils.integerToHexString(i, 1)
Convert hex string to integer.
int hexStringToInt(String value)
value - the hex string to convert
int - The integer value represented by the hex string.
def myInt = hubitat.helper.HexUtils.hexStringToInt("01A6")
Convert a byte array to hex string.
String byteArrayToHexString(byte[] value)
value - the byte array to convert
String - The hex string representation of the byte array
Convert a hex string to a byte array.
byte[] hexStringToByteArray(String value)
value - the hex string to convert (pairs of hex characters)
byte[] - The bytes represented by the hex string
Convert an integer array to a hex string.
String intArrayToHexString(int[] value)
value - the integer array to convert
String - The concatenated hex string representation of the integers
Convert a hex string into an integer array.
int[] hexStringToIntArray(String value)
value - the hex string to convert
int[] - The integer byte values represented by the hex string
Format one byte as hexadecimal text.
String byteToHexString(byte value)value - Byte to formatString - The two-character hex string for the byte
Decode hexadecimal byte text as ASCII text.
String hexStringToASCII(String value)value - Hexadecimal text to decodeString - The decoded ASCII text
Swap the byte order of a hex string.
String swapHexString(String value)value - Hexadecimal text to transformString - The hex string with its byte order swapped