the [if statement] to judge if the input is a hex number seems wrong. "11" will be decided to be a non-hex number.
here is my if statement just for your reference:
if ((hexChar-'0'<0||hexChar-'9'>0)&&(hexChar-'A'<0||hexChar-'F'>0)) throw new NumberFormatException (
"Not a hex number!");