code: private static byte[] pbkdf2(char[] password, byte[] salt, int iterations, int bytes) throws NoSuchAlgorithmException, InvalidKeySpecException {
  
      final PBEKeySpec spec = new PBEKeySpec(password, salt, iterations, bytes * 8);
      final SecretKeyFactory skf = SecretKeyFactory.getInstance(PBKDF2_ALGORITHM);
      return skf.generateSecret(spec).getEncoded();
    }
docs: Computes the PBKDF2 hash of a password.
  
  @param password
  the password to hash.
  @param salt
  the salt
  @param iterations
  the iteration count (slowness factor)
  @param bytes
  the length of the hash to compute in bytes
  
  @return the PBDKF2 hash of the password