Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
  2. public static String bytesToHex(byte[] bytes, int offset, int count) {
  3. char[] hexChars = new char[count * 2];
  4. for ( int j = 0; j < count; j++ ) {
  5. int v = bytes[j+offset] & 0xFF;
  6. hexChars[j * 2] = hexArray[v >>> 4];
  7. hexChars[j * 2 + 1] = hexArray[v & 0x0F];
  8. }
  9. return new String(hexChars);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement