If you are considering encrypting passwords and putting the result in a database then this is considered insecure. The more secure approach is to use a seeded digest. For example, one creates a random seed of say 8 bytes using SecureRandom and then one performs a digest (MD5, SHA1 or one of the SHA2 family) of the concatenation of the bytes of the password and the seed. Both the seed and the digest are then stored in the database. Using this approach it is not possible for anyone (the DBA or any casual database viewer for instance) to determine if two or more users have the same password and it is not possible to construct a single table mapping passwords to digests and then search for a particular password digest. One is forced to create a table for each user of the system.
Both MD5 and SHA1 have some known weaknesses so these days it is considered prudent to use one of the SHA2 algorithms. I use SHA-256.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
James gave good advice. All the algorithms he mentioned -particularly SHA-2- are implemented by JCE (the standard crypto API in Java), which is part of the Java class libraries. So you don't need any other library.