code: private static Object getSubjectAltName(X509Certificate cert, int type) {
          Collection<List<?>> subjectAltNames;
  
          try {
              subjectAltNames = cert.getSubjectAlternativeNames();
          } catch (CertificateParsingException cpe) {
              if (debug != null && Debug.isOn("handshake")) {
                  System.out.println(
                          "Attempt to obtain subjectAltNames extension failed!");
              }
              return null;
          }
  
          if (subjectAltNames != null) {
              for (List<?> subjectAltName : subjectAltNames) {
                  int subjectAltNameType = (Integer)subjectAltName.get(0);
                  if (subjectAltNameType == type) {
                      return subjectAltName.get(1);
                  }
              }
          }
  
          return null;
      }
docs: /*
  Returns the subject alternative name of the specified type in the
  subjectAltNames extension of a certificate.