Java tutorial
//package com.java2s; import java.io.ByteArrayOutputStream; public class Main { public static byte[] getByte(String ss) { String[] shil = ss.split(" "); StringBuilder er = new StringBuilder(); ByteArrayOutputStream out = new ByteArrayOutputStream(); for (String string : shil) { if ("".equals(string)) { continue; } int i = Integer.valueOf(string, 16); out.write(i); } return out.toByteArray(); } }