...
Java's MessageDigest class provides the functionality of various cryptographic hash functions. _ Be careful not use any of the defective functions that this class offers, such as _MD5.
It is also important that you append a salt to the password you are hashing. A salt is a piece of data that is randomly generated during the creation of the program (and consistent throughout the rest of its implementation). The use of a salt helps prevents dictionary attacks against the hash value, provided the salt is long enough.