daily pastebin goal
85%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static byte[] hexStringToByteArray(String s) {
  2.     int len = s.length();
  3.     byte[] data = new byte[len / 2];
  4.     for (int i = 0; i < len; i += 2) {
  5.         data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
  6.                              + Character.digit(s.charAt(i+1), 16));
  7.     }
  8.     return data;
  9. }
RAW Paste Data
Top