Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
protected static String byteArrayHex(byte [] bytes){
int hn, ln, cx;
String hexDigitChar="0123456789abcdef";
StringBuffer buf=new StringBuffer(bytes.length* 2);
for(cx=0; cx<bytes.length; cx++){
hn=((int)(bytes[cx]) & 0x00ff) /16;
ln=((int)(bytes[cx]) & 0x00ff);
buf.append(hexDigitChar.charAt(hn));
buf.append(hexDigitChar.charAt(ln));
}
return buf.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.