Here you can find the source of getMd5(byte... values)
public static String getMd5(byte... values)
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; public class Main { public static String getMd5(byte... values) { String cacheKey;/*from w w w.ja v a 2s.com*/ try { final MessageDigest mDigest = MessageDigest.getInstance("MD5"); mDigest.update(values); cacheKey = bytesToHexString(mDigest.digest()); } catch (NoSuchAlgorithmException e) { cacheKey = String.valueOf(Arrays.hashCode(values)); } return cacheKey; } private static String bytesToHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (byte aByte : bytes) { String hex = Integer.toHexString(0xFF & aByte); if (hex.length() == 1) { sb.append('0'); } sb.append(hex); } return sb.toString(); } }