Java - Hashing a Password

Java - Hashing a Password
//In this example we use the apache commons codec library to convert our hashed password to base 64
//the library can be found at: http://commons.apache.org/codec/download_codec.cgi
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Base64;
public class hashpword 
{
    public static void main(String[] args) throws NoSuchAlgorithmException
    {
        String password = "12345";
        MessageDigest digest = MessageDigest.getInstance("SHA-256");
        byte[] hashbytes = digest.digest(password.getBytes());
        String hashpassword = Base64.encodeBase64String(hashbytes);
        System.out.println(hashpassword);
    }
}