I did it like this:
private String getEncryptedPassword(String input){
String output = "";
try{
byte [] hash = java.security.MessageDigest.getInstance("MD5").digest(input.getBytes());
StringBuilder builder = new StringBuilder("");
for(int i = 0; i < hash.length; i++){
builder.append(Integer.toHexString(hash[i] & 0xFF | 0x100).substring(1, 3));
}
output = builder.toString();
}
catch(Exception ex){
}
return output;
}
Hope this helps...