Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
- public static String bytesToHex(byte[] bytes, int offset, int count) {
- char[] hexChars = new char[count * 2];
- for ( int j = 0; j < count; j++ ) {
- int v = bytes[j+offset] & 0xFF;
- hexChars[j * 2] = hexArray[v >>> 4];
- hexChars[j * 2 + 1] = hexArray[v & 0x0F];
- }
- return new String(hexChars);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement