Here you can find the source of getMD5(byte[] source)
private static String getMD5(byte[] source)
//package com.java2s; import java.security.MessageDigest; public class Main { private static String getMD5(byte[] source) { try {//from w w w . j a v a 2 s .co m MessageDigest md5 = MessageDigest.getInstance("MD5"); StringBuffer result = new StringBuffer(); for (byte b : md5.digest(source)) { result.append(Integer.toHexString((b & 0xf0) >>> 4)); result.append(Integer.toHexString(b & 0x0f)); } return result.toString(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } }