Following is a code that will encrypts the user String :
import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.No
Have a look at Apache Commons Codec: https://commons.apache.org/codec/
E.g.: https://commons.apache.org/codec/api-release/org/apache/commons/codec/digest/DigestUtils.html