Java tutorial
//package com.java2s; public class Main { public static byte[] hexStringToByteArray(String paramString) { int i = paramString.length(); byte[] arrayOfByte = new byte[i / 2]; for (int j = 0; j < i; j += 2) { arrayOfByte[(j / 2)] = ((byte) ((Character.digit(paramString.charAt(j), 16) << 4) + Character.digit(paramString.charAt(j + 1), 16))); } return arrayOfByte; } }