title: Convert MD5 into String in java
body: <p>Can anyone know how to convert the <strong>MD5</strong> to <strong>String</strong>. In my case I have saved the password in <strong>MD5</strong> in database. I am trying to retreive the password and display it in string for the editing purpose.</p>
  
  <p>This is what I have done for converting the string into encrypt format:</p>
  
  <pre><code>public static String encrypt(String source) {
     String md5 = null;
     try {
           MessageDigest mdEnc = MessageDigest.getInstance("MD5"); //Encryption algorithm
           mdEnc.update(source.getBytes(), 0, source.length());
           md5 = new BigInteger(1, mdEnc.digest()).toString(16); // Encrypted string
          } 
      catch (Exception ex) {
           return null;
      }
      return md5;
  }
  </code></pre>
  
  <p>I don't know how convert the encrypt format into string for editing the password.</p>