Here you can find the source of charToByte(char aChar)
public static byte charToByte(char aChar)
//package com.java2s; //License from project: Open Source License public class Main { public static byte charToByte(char aChar) { byte ref; if (aChar >= '0' && aChar <= '9') { ref = (byte) '0'; } else if (aChar >= 'a' && aChar <= 'f') { ref = (byte) 'a' - 10; } else {/*from w w w . j a va2s . co m*/ throw new IllegalArgumentException("The char '" + aChar + "' is a not valid hex value"); } return (byte) (aChar - ref); } }