Here you can find the source of convertHexCharacterToHalfByte(char character)
static byte convertHexCharacterToHalfByte(char character)
//package com.java2s; //License from project: Open Source License public class Main { static byte convertHexCharacterToHalfByte(char character) { if ((character >= '0') && (character <= '9')) { return (byte) (character - '0'); } else if ((character >= 'a') && (character <= 'f')) { return (byte) (character - 'a' + 10); } else if ((character >= 'A') && (character <= 'F')) { return (byte) (character - 'A' + 10); } else {/*from w ww . j a v a 2s . c o m*/ throw new IllegalArgumentException("'" + character + "' is an illegal character in HEX code!"); } } }