Here you can find the source of md5(byte[] bytes)
private static String md5(byte[] bytes) throws NoSuchAlgorithmException
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static String md5(byte[] bytes) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(bytes);/*from ww w . j av a 2s. co m*/ byte[] bs = md.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < bs.length; i++) { int v = bs[i] & 0xff; if (v < 16) { sb.append(0); } sb.append(Integer.toHexString(v)); } return sb.toString(); } }