code: static int mergeBasicConstraints(X509Certificate cert, int maxPathLength) {
  
          int pathLenConstraint = cert.getBasicConstraints();
  
          if (!X509CertImpl.isSelfIssued(cert)) {
              maxPathLength--;
          }
  
          if (pathLenConstraint < maxPathLength) {
              maxPathLength = pathLenConstraint;
          }
  
          return maxPathLength;
      }
docs: Merges the specified maxPathLength with the pathLenConstraint
  obtained from the certificate.
  
  @param cert the <code>X509Certificate</code>
  @param maxPathLength the previous maximum path length
  @return the new maximum path length constraint (-1 means no more
  certificates can follow, Integer.MAX_VALUE means path length is
  unconstrained)