Here you can find the source of md5Hex(byte data[])
public static String md5Hex(byte data[])
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static final String HEX_CHARS = "0123456789abcdef"; public static String md5Hex(byte data[]) { return toHexString(md5(data)); }/*from w w w . ja v a 2 s.c om*/ public static String md5Hex(String data) { return toHexString(md5(data)); } public static String toHexString(byte b[]) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { sb.append(HEX_CHARS.charAt(b[i] >>> 4 & 0xf)); sb.append(HEX_CHARS.charAt(b[i] & 0xf)); } return sb.toString(); } public static byte[] md5(byte data[]) { return getDigest().digest(data); } public static byte[] md5(String data) { return md5(data.getBytes()); } static MessageDigest getDigest() { try { return MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }