private static String encryptPassword(String password) {

        /* Declare local variables to be used in generating hashed password*/

        String hashPassword = "";
        int numberOfIterations = 7535;
        char[] passwordChar = password.toCharArray();
        byte[] saltBytes = new byte[16];

        /* This is where we generate the salt */

        try {
            SecureRandom secureRandom = SecureRandom.getInstance(SALT_ALGORITHM);
            secureRandom.nextBytes(saltBytes);
        } catch(NoSuchAlgorithmException e) {
            throw new ApplicationException("Failed while generating salt: " + e.getMessage(), e);
        }

        /* Creating variables used to generate hash */
        PBEKeySpec pbeKeySpec = new PBEKeySpec(passwordChar, saltBytes, numberOfIterations, 64 * 8);
        SecretKeyFactory secretKeyFactory;
        try {
            secretKeyFactory = SecretKeyFactory.getInstance(SECRET_KEY_ALGORITHM);
        } catch (NoSuchAlgorithmException e) {
            throw new ApplicationException("Failed while fetching secret key factory: " + e.getMessage(), e);
        }

        /* Actually generating the hash */
        byte[] hashBytes = new byte[0];
        try {
            if (secretKeyFactory != null) {
                hashBytes = secretKeyFactory.generateSecret(pbeKeySpec).getEncoded();
            }
        } catch (InvalidKeySpecException e) {
            throw new ApplicationException("Failed while generating hash: " + e.getMessage(), e);
        }

        /* Assigning the return value */
        try {
            hashPassword = numberOfIterations + ":" + transformPasswordToHex(saltBytes) + ":" + transformPasswordToHex(hashBytes);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return hashPassword;
    }