Here you can find the source of md5ByHex(String src)
public static String md5ByHex(String src)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; public class Main { public static String md5ByHex(String src) { try {//w w w. j a v a 2s.c om MessageDigest md = MessageDigest.getInstance("MD5"); byte[] b = src.getBytes(); md.reset(); md.update(b); byte[] hash = md.digest(); String hs = ""; String stmp = ""; for (int i = 0; i < hash.length; i++) { stmp = Integer.toHexString(hash[i] & 0xFF); if (stmp.length() == 1) hs = hs + "0" + stmp; else { hs = hs + stmp; } } return hs.toUpperCase(); } catch (Exception e) { return ""; } } }