List of utility methods to do Byte to Hex String
String | byteToHexStr(byte b) byte To Hex Str char[] digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; char[] tempArr = new char[2]; tempArr[0] = digit[(b >>> 4) & 0x0F]; tempArr[1] = digit[b & 0x0F]; return new String(tempArr); |
String | byteToHexStr(byte b) byte To Hex Str int v = b & 0xFF; String result = HEX_BYTE_STRINGS[v]; if (result == null) { result = Character.toString(HEX_CHAR_ARRAY[v >>> 4]) + HEX_CHAR_ARRAY[v & 0x0f]; HEX_BYTE_STRINGS[v] = result; return result; |
String | byteToHexStr(byte buf[]) byte To Hex Str StringBuffer sb = new StringBuffer(); for (int i = 0; i < buf.length; i++) { String hex = Integer.toHexString(buf[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; sb.append(hex); return sb.toString(); |
String | byteToHexStr(byte src, int len, int code) byte To Hex Str return longToHexStr(src, len, code);
|
String | byteToHexstr(byte[] b, boolean space) byte To Hexstr StringBuilder toHex = new StringBuilder(); for (int i = 0; (null != b) && (i < b.length); i++) { if (space) { toHex.append(' '); char hi = Character.forDigit((b[i] >> 4) & 0x0F, 16); char lo = Character.forDigit(b[i] & 0x0F, 16); toHex.append(Character.toUpperCase(hi)); ... |
String | byteToHexStr(byte[] bArray) byte convert Hex String, such as byte[]{0x01,0x0A}-->01 0A return byteToHexStr(bArray, false);
|
String | byteToHexString(byte _b) byte To Hex String if ((_b < 0) || (_b > 0xf)) { return Integer.toHexString(_b & 0xFF); } else { StringBuffer sb = new StringBuffer(); sb.append('0'); sb.append(hexChars[_b]); return sb.toString(); |
Object | byteToHexString(byte b) Convert the byte b into an hex String return Integer.toHexString(b & 0xFF) + " "; |
String | byteToHexString(byte b) byte To Hex String char[] hexChar = new char[2]; int v = b & 0xFF; hexChar[0] = hexArray[v >>> 4]; hexChar[1] = hexArray[v & 0x0F]; return new String(hexChar); |
String | byteToHexString(byte b) byte To Hex String int left = (int) ((b & 0xf0) >> 4); int right = (int) (b & 0x0f); return Integer.toHexString(left) + Integer.toHexString(right); |