Here you can find the source of hexToBt64(String hex)
private static String hexToBt64(String hex)
//package com.java2s; public class Main { private static String hexToBt64(String hex) { String binary = ""; for (int i = 0; i < 16; i++) { binary += hexToBt4(hex.substring(i, i + 1)); }//from w ww. j a v a 2s . com return binary; } private static String hexToBt4(String hex) { String binary = ""; if (hex.equalsIgnoreCase("0")) { binary = "0000"; } else if (hex.equalsIgnoreCase("1")) { binary = "0001"; } if (hex.equalsIgnoreCase("2")) { binary = "0010"; } if (hex.equalsIgnoreCase("3")) { binary = "0011"; } if (hex.equalsIgnoreCase("4")) { binary = "0100"; } if (hex.equalsIgnoreCase("5")) { binary = "0101"; } if (hex.equalsIgnoreCase("6")) { binary = "0110"; } if (hex.equalsIgnoreCase("7")) { binary = "0111"; } if (hex.equalsIgnoreCase("8")) { binary = "1000"; } if (hex.equalsIgnoreCase("9")) { binary = "1001"; } if (hex.equalsIgnoreCase("A")) { binary = "1010"; } if (hex.equalsIgnoreCase("B")) { binary = "1011"; } if (hex.equalsIgnoreCase("C")) { binary = "1100"; } if (hex.equalsIgnoreCase("D")) { binary = "1101"; } if (hex.equalsIgnoreCase("E")) { binary = "1110"; } if (hex.equalsIgnoreCase("F")) { binary = "1111"; } return binary; } }