Convert a character to a hexadecimal string representation. @param c the character to convert @return the hexadecimal string representation of the character
(char c)
| 95 | * @return the hexadecimal string representation of the character |
| 96 | */ |
| 97 | public static String toHexString(char c) { |
| 98 | // 2 bytes / 4 hex digits |
| 99 | StringBuilder sb = new StringBuilder(4); |
| 100 | |
| 101 | sb.append(hex[(c & 0xf000) >> 12]); |
| 102 | sb.append(hex[(c & 0x0f00) >> 8]); |
| 103 | |
| 104 | sb.append(hex[(c & 0xf0) >> 4]); |
| 105 | sb.append(hex[(c & 0x0f)]); |
| 106 | |
| 107 | return sb.toString(); |
| 108 | } |
| 109 | |
| 110 | |
| 111 | /** |