Java tutorial
//package com.java2s; public class Main { public static byte[] toByte(String paramString) { int j = paramString.length() / 2; byte[] arrayOfByte = new byte[j]; int i = 0; while (i < j) { arrayOfByte[i] = Integer.valueOf(paramString.substring(i * 2, i * 2 + 2), 16).byteValue(); i += 1; } return arrayOfByte; } }