Here you can find the source of hexStr2ByteArr(String paramString)
public static byte[] hexStr2ByteArr(String paramString) throws Exception
//package com.java2s; public class Main { public static byte[] hexStr2ByteArr(String paramString) throws Exception { byte[] arrayOfByte1 = paramString.getBytes(); int i = arrayOfByte1.length; byte[] arrayOfByte2 = new byte[i / 2]; for (int j = 0; j < i; j += 2) { String str = new String(arrayOfByte1, j, 2); arrayOfByte2[(j / 2)] = (byte) Integer.parseInt(str, 16); }/*from www . java 2 s. co m*/ return arrayOfByte2; } }