List of utility methods to do Hex String Create
void | appendHex(StringBuffer sb, byte b) append Hex sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f)); |
byte | isHexChar(char ch) Return true if the string is HexChars(1234567890abcdefABCDEF). if ('a' <= ch && ch <= 'f') return (byte) (ch - 'a' + 10); if ('A' <= ch && ch <= 'F') return (byte) (ch - 'A' + 10); if ('0' <= ch && ch <= '9') return (byte) (ch - '0'); return -1; |
boolean | isHexChar(String hexString, boolean checkSpaceFlag) Method Check String if (null == hexString || 0 == hexString.length()) return false; int hexLen = hexString.length(); int hexCharCount = 0; char ch; for (int i = 0; i < hexLen; i++) { ch = hexString.charAt(i); if (ch == ' ') { ... |
boolean | isHexChar(String hexString) Method Check String return isHexChar(hexString, true);
|
char | toHexChar(int nibble) Convert a nibble to a hex character return hexDigit[(nibble & 0xF)];
|
void | appendHex(final StringBuffer buf, final byte i) append Hex buf.append(Character.forDigit((i & 0xf0) >> 4, 16)); buf.append(Character.forDigit((i & 0x0f), 16)); |
void | appendHex(final StringBuffer buf, final int i) append Hex buf.append(Integer.toHexString((i >> 24) & 0xff)); buf.append(Integer.toHexString((i >> 16) & 0xff)); buf.append(Integer.toHexString((i >> 8) & 0xff)); buf.append(Integer.toHexString(i & 0xff)); |
String | toHex(final int i) to Hex StringBuffer buf = new StringBuffer(); appendHex(buf, i); return buf.toString(); |
void | appendHexJavaScriptRepresentation(int codePoint, Appendable out) Returns a javascript representation of the character in a hex escaped format. if (Character.isSupplementaryCodePoint(codePoint)) { char[] surrogates = Character.toChars(codePoint); appendHexJavaScriptRepresentation(surrogates[0], out); appendHexJavaScriptRepresentation(surrogates[1], out); return; out.append("\\u").append(HEX_CHARS[(codePoint >>> 12) & 0xf]) .append(HEX_CHARS[(codePoint >>> 8) & 0xf]) ... |
void | appendHexJavaScriptRepresentation(StringBuilder sb, char c) Although this is a rather specific method, it is made public because it is also used by the JSCompiler. try { appendHexJavaScriptRepresentation(c, sb); } catch (IOException ex) { throw new RuntimeException(ex); |