Here you can find the source of md5Hex(String str)
public static String md5Hex(String str) throws Exception
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; public class Main { public static String md5Hex(String str) throws Exception { if (str == null) { return null; }// w w w . jav a 2 s .c om StringBuffer hexStrSb = new StringBuffer(); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(str.getBytes()); for (int i = 0; i < hash.length; i++) { if ((0xff & hash[i]) < 0x10) { hexStrSb.append("0" + Integer.toHexString((0xFF & hash[i]))); } else { hexStrSb.append(Integer.toHexString(0xFF & hash[i])); } } return hexStrSb.toString(); } }