code: public static boolean validatePassword(char[] password, String goodHash) throws NoSuchAlgorithmException, InvalidKeySpecException {
  
      final String[] params = goodHash.split(":");
      final int iterations = Integer.parseInt(params[ITERATION_INDEX]);
      final byte[] salt = fromHex(params[SALT_INDEX]);
      final byte[] hash = fromHex(params[PBKDF2_INDEX]);
      // Compute the hash of the provided password, using the same salt,
      // iteration count, and hash length
      final byte[] testHash = pbkdf2(password, salt, iterations, hash.length);
      // Compare the hashes in constant time. The password is correct if
      // both hashes match.
      return slowEquals(hash, testHash);
    }
docs: Validates a password using a hash.
  
  @param password
  the password to check
  @param goodHash
  the hash of the valid password
  
  @return true if the password is correct, false if not