code: public static synchronized X509CertImpl intern(X509Certificate c)
              throws CertificateException {
          if (c == null) {
              return null;
          }
          boolean isImpl = c instanceof X509CertImpl;
          byte[] encoding;
          if (isImpl) {
              encoding = ((X509CertImpl)c).getEncodedInternal();
          } else {
              encoding = c.getEncoded();
          }
          X509CertImpl newC = (X509CertImpl)getFromCache(certCache, encoding);
          if (newC != null) {
              return newC;
          }
          if (isImpl) {
              newC = (X509CertImpl)c;
          } else {
              newC = new X509CertImpl(encoding);
              encoding = newC.getEncodedInternal();
          }
          addToCache(certCache, encoding, newC);
          return newC;
      }
docs: Return an interned X509CertImpl for the given certificate.
  If the given X509Certificate or X509CertImpl is already present
  in the cert cache, the cached object is returned. Otherwise,
  if it is a X509Certificate, it is first converted to a X509CertImpl.
  Then the X509CertImpl is added to the cache and returned.
  
  Note that all certificates created via generateCertificate(InputStream)
  are already interned and this method does not need to be called.
  It is useful for certificates that cannot be created via
  generateCertificate() and for converting other X509Certificate
  implementations to an X509CertImpl.