Here you can find the source of getMD5Code(String value)
public static String getMD5Code(String value)
//package com.java2s; //License from project: LGPL import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String getMD5Code(String value) { if (value == null) { value = ""; }// w ww . ja v a 2 s . c om try { MessageDigest md = MessageDigest.getInstance("MD5"); md.reset(); md.update(value.getBytes()); byte[] md5Bytes = md.digest(); StringBuffer hexValue = new StringBuffer(); for (int i = 0; i < md5Bytes.length; i++) { int val = ((int) md5Bytes[i]) & 0xff; if (val < 16) hexValue.append("0"); hexValue.append(Integer.toHexString(val)); } return hexValue.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } }