Here you can find the source of binToHex(String bin)
public static String binToHex(String bin)
//package com.java2s; //License from project: Open Source License public class Main { public static String binToHex(String bin) { String result = ""; int decimal; for (int i = 4; (i <= 64 && i <= bin.length()); i = i + 4) { decimal = Integer.parseInt(bin.substring((i - 4), i), 2); result = result.concat(Integer.toString(decimal, 16)).toUpperCase(); }//from w w w . ja va2 s. c o m return result; } }