Java tutorial
//package com.java2s; public class Main { public static String binaryToHexString(byte[] messageDigest) { // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i = 0; i < messageDigest.length; i++) { int by = 0xFF & messageDigest[i]; if (by < 0x10) { hexString.append("0").append(Integer.toHexString(by)); } else if (by >= 0x10) { hexString.append(Integer.toHexString(by)); } } return hexString.toString(); } }