Here you can find the source of toHexDigit(char ch)
private static int toHexDigit(char ch)
//package com.java2s; //License from project: Apache License public class Main { private static int toHexDigit(char ch) { if ((ch <= '9') && (ch >= '0')) { return (ch - '0'); }//w w w.j av a 2s. c om if ((ch >= 'a') && (ch <= 'f')) { return ((ch - 'a') + 10); } if ((ch < 'A') || (ch > 'F')) { throw new IllegalArgumentException("Illegal hexadecimal charcter + " + ch); } return ((ch - 'A') + 10); } }