Methods Summary |
---|
public static byte[] | decodeHex(java.lang.String hexString)
ByteArrayOutputStream bas = new ByteArrayOutputStream();
for (int i = 0; i < hexString.length(); i += 2) {
int b = Integer.parseInt(hexString.substring(i, i + 2), 16);
bas.write(b);
}
return bas.toByteArray();
|
public static java.lang.String | encodeHex(byte[] data)
return encodeHex(data, 0);
|
public static java.lang.String | encodeHex(byte[] data, int group)
int l = data.length;
char[] out = new char[(l << 1) + (group > 0 ? (l / group) : 0)];
// two characters form the hex value.
for (int i = 0, j = 0; i < l; i++) {
if ((group > 0) && ((i % group) == 0) && j > 0) {
out[j++] = '-";
}
out[j++] = DIGITS[(0xF0 & data[i]) >>> 4];
out[j++] = DIGITS[0x0F & data[i]];
}
return new String(out);
|