code: public static final KeyAgreement getInstance(String algorithm)
              throws NoSuchAlgorithmException {
          List<Service> services =
                  GetInstance.getServices("KeyAgreement", algorithm);
          // make sure there is at least one service from a signed provider
          Iterator<Service> t = services.iterator();
          while (t.hasNext()) {
              Service s = t.next();
              if (JceSecurity.canUseProvider(s.getProvider()) == false) {
                  continue;
              }
              return new KeyAgreement(algorithm);
          }
          throw new NoSuchAlgorithmException
                                  ("Algorithm " + algorithm + " not available");
      }
docs: Returns a <code>KeyAgreement</code> object that implements the
  specified key agreement algorithm.
  
  <p> This method traverses the list of registered security Providers,
  starting with the most preferred Provider.
  A new KeyAgreement object encapsulating the
  KeyAgreementSpi implementation from the first
  Provider that supports the specified algorithm is returned.
  
  <p> Note that the list of registered providers may be retrieved via
  the {@link Security#getProviders() Security.getProviders()} method.
  
  @param algorithm the standard name of the requested key agreement
  algorithm.
  See the KeyAgreement section in the <a href=
  "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyAgreement">
  Java Cryptography Architecture Standard Algorithm Name Documentation</a>
  for information about standard algorithm names.
  
  @return the new <code>KeyAgreement</code> object.
  
  @exception NullPointerException if the specified algorithm
  is null.
  
  @exception NoSuchAlgorithmException if no Provider supports a
  KeyAgreementSpi implementation for the
  specified algorithm.
  
  @see java.security.Provider