import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;public class StringUtils {public static String strToMD5(String args) {StringBuilder strMD5 = new StringBuilder();try {MessageDigest digest = MessageDigest.getInstance("MD5");byte[] md5Byte = digest.digest(args.getBytes()); for(byte x : md5Byte) { if((x & 0xff)>>4 == 0) { strMD5.append("0").append(Integer.toHexString(x & 0xff)); } else { strMD5.append(Integer.toHexString(x & 0xff)); } }} catch (NoSuchAlgorithmException e) {e.printStackTrace();}return strMD5.toString();}}