Skip to content

Instantly share code, notes, and snippets.

@jmatsu
Created July 17, 2014 06:04
Show Gist options
  • Save jmatsu/0f9b3d881111d76d57ce to your computer and use it in GitHub Desktop.
Save jmatsu/0f9b3d881111d76d57ce to your computer and use it in GitHub Desktop.
Utilis sample
private static String toHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes[i] & 0xff);
if (hex.length() == 1) {
sb.append("0");
}
sb.append(hex);
}
return sb.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment