Generate MD5 Hash in Java

package nilpointer.net;

import java.math.BigInteger;
import java.security.MessageDigest;

public class Demo {

	public static void main(String[] args) {

		try {
			String password = "123";
			MessageDigest messageDigest = MessageDigest.getInstance("MD5");
			messageDigest.update(password.getBytes(), 0, password.length());
			BigInteger i = new BigInteger(1, messageDigest.digest());
			String hash = String.format("%1$032x", i);
			System.out.println("Md5: " + hash);
		} catch (Exception e) {
			System.err.println(e.getMessage());
		}

	}

}
Md5: 202cb962ac59075b964b07152d234b70