code: public static String createHash(char[] password) throws NoSuchAlgorithmException, InvalidKeySpecException {
          // Generate a random salt
          SecureRandom random = new SecureRandom();
          byte[] salt = new byte[SALT_BYTE_SIZE];
          random.nextBytes(salt);
  
          // Hash the password
          byte[] hash = pbkdf2(password, salt, PBKDF2_ITERATIONS, HASH_BYTE_SIZE);
          // format iterations:salt:hash
          return PBKDF2_ITERATIONS + ":" + toHex(salt) + ":" + toHex(hash);
      }
docs: Returns a salted PBKDF2 hash of the password.
  
  @param password
  the password to hash
  @return a salted PBKDF2 hash of the password
  @throws NoSuchAlgorithmException if jdk does not support the algorithm
  @throws InvalidKeySpecException if the password or salt are invalid