Here you can find the source of MD5String(String str)
public static String MD5String(String str) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String MD5String(String str) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(str.getBytes());/*w w w. jav a 2 s.c o m*/ byte[] digest = md.digest(); StringBuffer sb = new StringBuffer(); for (byte b : digest) { sb.append(Integer.toHexString((int) (b & 0xff))); } return sb.toString(); } }