Java Utililty Methods Byte to Hex Char

List of utility methods to do Byte to Hex Char

Description

The list of methods to do Byte to Hex Char are organized into topic(s).

Method

ObjectbyteToHexChar(byte b)
byte To Hex Char
int n = b;
if (n < 0) {
    n = 256 + n;
int d1 = n / 16;
int d2 = n % 16;
return hex[d1] + hex[d2];
char[]byteToHexChars(byte value)
Converts byte value to sequence of hexadecimal characters.
char[] result = new char[2];
byteToHexChars(result, value);
return result;
char[]byteToHexChars(int n)
Returns an array of 2 hexadecimal digits (most significant digit first) corresponding to the lowest 8 bits of n.
char[] buf = { HEX_DIGITS[(n >>> 4) & 0x0F], HEX_DIGITS[n & 0x0F] };
return buf;