Java tutorial
//package com.java2s; //License from project: Apache License public class Main { private static final String HEX = "0123456789ABCDEF"; public static byte hexToByte(String hexString) { byte out; //make a bit representation in an int of the hex value int hn = HEX.indexOf(hexString.charAt(0)); int ln = HEX.indexOf(hexString.charAt(1)); //now just shift the high order nibble and add them together out = (byte) ((hn << 4) | ln); return out; } }