Here you can find the source of MD5(String... texts)
public static String MD5(String... texts) throws Exception
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; public class Main { private static final char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static String MD5(String... texts) throws Exception { try {//from w w w . j a v a 2 s. c om if (texts == null || texts.length == 0) return null; MessageDigest messageDigest = MessageDigest.getInstance("MD5"); for (String tt : texts) messageDigest.update(tt.getBytes()); byte[] updateBytes = messageDigest.digest(); int len = updateBytes.length; char myChar[] = new char[len * 2]; int k = 0; for (int i = 0; i < len; i++) { byte byte0 = updateBytes[i]; myChar[k++] = hexDigits[byte0 >>> 4 & 0x0f]; myChar[k++] = hexDigits[byte0 & 0x0f]; } return new String(myChar); } catch (Exception e) { throw e; } } }