Here you can find the source of hex2byte(String inputString)
private static byte[] hex2byte(String inputString)
//package com.java2s; public class Main { private static byte[] hex2byte(String inputString) { if (inputString == null || inputString.length() < 2) { return new byte[0]; }/*w w w . j a v a 2s.c o m*/ inputString = inputString.toLowerCase(); int l = inputString.length() / 2; byte[] result = new byte[l]; for (int i = 0; i < l; ++i) { String tmp = inputString.substring(2 * i, 2 * i + 2); result[i] = (byte) (Integer.parseInt(tmp, 16) & 0xFF); } return result; } }