Here you can find the source of BinaryToHexString(byte[] bytes)
public static String BinaryToHexString(byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { private static String hexStr = "0123456789ABCDEF"; public static String BinaryToHexString(byte[] bytes) { String result = ""; String hex = ""; for (int i = 0; i < bytes.length; i++) { hex = String.valueOf(hexStr.charAt((bytes[i] & 0xF0) >> 4)); hex += String.valueOf(hexStr.charAt(bytes[i] & 0x0F)); result += hex;//from w ww . j av a 2 s. co m } return result; } }