Created
July 17, 2014 06:04
-
-
Save jmatsu/0f9b3d881111d76d57ce to your computer and use it in GitHub Desktop.
Utilis sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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