code: public static String deriveCodeVerifierChallenge(String codeVerifier) {
          try {
              MessageDigest sha256Digester = MessageDigest.getInstance("SHA-256");
              sha256Digester.update(codeVerifier.getBytes("ISO_8859_1"));
              byte[] digestBytes = sha256Digester.digest();
              return Base64.getUrlEncoder().withoutPadding().encodeToString(digestBytes);
          } catch (NoSuchAlgorithmException e) {
              logger.warn("SHA-256 is not supported on this device! Using plain challenge", e);
              return codeVerifier;
          } catch (UnsupportedEncodingException e) {
              logger.error("ISO-8859-1 encoding not supported on this device!", e);
              throw new IllegalStateException("ISO-8859-1 encoding not supported", e);
          }
      }
docs: Produces a challenge from a code verifier, using SHA-256 as the challenge method if the
  system supports it (all Android devices _should_ support SHA-256), and falls back
  to the "plain" challenge type if unavailable.
  @param codeVerifier code verifier
  @return String derived challenge