code: public void initState(BuilderParams buildParams)
          throws CertPathValidatorException
      {
          /*
           * Initialize number of remainingCACerts.
           * Note that -1 maxPathLen implies unlimited.
           * 0 implies only an EE cert is acceptable.
           */
          int maxPathLen = buildParams.maxPathLength();
          remainingCACerts = (maxPathLen == -1) ? Integer.MAX_VALUE
                                                : maxPathLen;
  
          /* Initialize explicit policy state variable */
          if (buildParams.explicitPolicyRequired()) {
              explicitPolicy = 0;
          } else {
              // unconstrained if maxPathLen is -1,
              // otherwise, we want to initialize this to the value of the
              // longest possible path + 1 (i.e. maxpathlen + finalcert + 1)
              explicitPolicy = (maxPathLen == -1) ? maxPathLen : maxPathLen + 2;
          }
  
          /* Initialize policy mapping state variable */
          if (buildParams.policyMappingInhibited()) {
              policyMapping = 0;
          } else {
              policyMapping = (maxPathLen == -1) ? maxPathLen : maxPathLen + 2;
          }
  
          /* Initialize inhibit any policy state variable */
          if (buildParams.anyPolicyInhibited()) {
              inhibitAnyPolicy = 0;
          } else {
              inhibitAnyPolicy = (maxPathLen == -1) ? maxPathLen : maxPathLen + 2;
          }
  
          /* Initialize certIndex */
          certIndex = 1;
  
          /* Initialize policy tree */
          Set<String> initExpPolSet = new HashSet<>(1);
          initExpPolSet.add(PolicyChecker.ANY_POLICY);
  
          rootNode = new PolicyNodeImpl(null, PolicyChecker.ANY_POLICY, null,
                                        false, initExpPolSet, false);
  
          /*
           * Initialize each user-defined checker
           * Shallow copy the checkers
           */
          userCheckers = new ArrayList<>(buildParams.certPathCheckers());
          /* initialize each checker (just in case) */
          for (PKIXCertPathChecker checker : userCheckers) {
              checker.init(false);
          }
  
          /* Start by trusting the cert to sign CRLs */
          crlSign = true;
  
          init = true;
      }
docs: Initialize the state.
  
  @param buildParams builder parameters