public static void hexToBin(String slovo) {
    StringBuffer s = new StringBuffer(4 * slovo.length()); 
    String[] table = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001"}; 

    for (int i = 0; i < slovo.length(); i++) {
        switch (slovo.toLowerCase().charAt(i)) {
          case 'a' :  s.append("1010");break; 
          case 'b' :  s.append("1011");break; 
          case 'c' :  s.append("1100");break; 
          case 'd' :  s.append("1101");break; 
          case 'e' :  s.append("1110");break; 
          case 'f' :  s.append("1111");break; 
          default  :  s.append(table[(Integer.valueOf(slovo.toLowerCase().charAt(i)).intValue() - 48)]);break; 
        }
    }
    System.out.println("hex: " + s); 
  }