List of utility methods to do Hex Calculate
String | toHexString(String s) to Hex String String str = ""; for (int i = 0; i < s.length(); i++) { int ch = s.charAt(i); String s4 = Integer.toHexString(ch); str = str + s4; return str; |
String | toHexString(String s) to Hex String StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (i > 0) { sb.append(' '); if (ch < 128) { sb.append(ch); ... |
String | toHexString(String s) to Hex String byte[] baKeyword = new byte[s.length() / 2]; for (int i = 0; i < baKeyword.length; i++) { try { baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); } catch (Exception e) { e.printStackTrace(); try { s = new String(baKeyword, "utf-8"); } catch (Exception e1) { e1.printStackTrace(); return s; |
String[] | toHexString(String str) to Hex String char[] chars = str.toCharArray(); String[] result = new String[chars.length]; for (int i = 0; i < chars.length; i++) { result[i] = Integer.toHexString((int) chars[i]); return result; |
String | toHexString(String str) to Hex String int hashCode = str.hashCode(); return toHexString(hashCode); |
void | toHexString(StringBuffer buffer, byte[] bytes, int numBytes) to Hex String buffer.append('['); if (bytes != null) { for (int i = 0; i < numBytes; i++) { String chars = Integer.toHexString(bytes[i] & 0xFF); if (chars.length() == 1) { buffer.append('0'); buffer.append(chars); ... |
String | toHexString0x(byte[] byteArray) to Hex Stringx if (byteArray == null) { return null; return "0x" + toHexString(byteArray); |
String | toHexString2(int i) to Hex String String zeros = "00000000000"; String hex = Integer.toHexString(i); int len = hex.length(); if (len < 2) return zeros.substring(0, 2 - len) + hex; else return hex.substring(0, 2); |
String | toHexString3(byte aByte) to Hex String String str = Integer.toHexString(byteToInt(aByte)); String s = str.length() == 1 ? "0x0" + str : "0x" + str; return s; |
String | toHexStringBE(char[] array) to Hex String BE return toHexStringBE(array, 0, array.length);
|