Here you can find the source of toBinFromHexChar(final char hex)
public static String toBinFromHexChar(final char hex)
//package com.java2s; //License from project: Open Source License public class Main { public static String toBinFromHexChar(final char hex) { switch (hex) { case '0': return ("0000"); case '1': return ("0001"); case '2': return ("0010"); case '3': return ("0011"); case '4': return ("0100"); case '5': return ("0101"); case '6': return ("0110"); case '7': return ("0111"); case '8': return ("1000"); case '9': return ("1001"); case 'a': case 'A': return ("1010"); case 'b': case 'B': return ("1011"); case 'c': case 'C': return ("1100"); case 'd': case 'D': return ("1101"); case 'e': case 'E': return ("1110"); case 'f': case 'F': return ("1111"); default:/*from w w w . j av a2s . c om*/ throw new IllegalArgumentException( "The input character \'" + hex + "\'is not a valid hexadecimal character."); } } }