Android Utililty Methods Hex String Create

List of utility methods to do Hex String Create

Description

The list of methods to do Hex String Create are organized into topic(s).

Method

voidappendHex(StringBuffer sb, byte b)
append Hex
sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f));
byteisHexChar(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;
booleanisHexChar(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 == ' ') {
...
booleanisHexChar(String hexString)
Method Check String
return isHexChar(hexString, true);
chartoHexChar(int nibble)
Convert a nibble to a hex character
return hexDigit[(nibble & 0xF)];
voidappendHex(final StringBuffer buf, final byte i)
append Hex
buf.append(Character.forDigit((i & 0xf0) >> 4, 16));
buf.append(Character.forDigit((i & 0x0f), 16));
voidappendHex(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));
StringtoHex(final int i)
to Hex
StringBuffer buf = new StringBuffer();
appendHex(buf, i);
return buf.toString();
voidappendHexJavaScriptRepresentation(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])
...
voidappendHexJavaScriptRepresentation(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);