code: public static Signature getInstance(String algorithm)
              throws NoSuchAlgorithmException {
          List<Service> list;
          if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
              list = GetInstance.getServices(rsaIds);
          } else {
              list = GetInstance.getServices("Signature", algorithm);
          }
          Iterator<Service> t = list.iterator();
          if (t.hasNext() == false) {
              throw new NoSuchAlgorithmException
                  (algorithm + " Signature not available");
          }
          // try services until we find an Spi or a working Signature subclass
          NoSuchAlgorithmException failure;
          do {
              Service s = t.next();
              if (isSpi(s)) {
                  return new Delegate(algorithm);
              } else {
                  // must be a subclass of Signature, disable dynamic selection
                  try {
                      Instance instance =
                          GetInstance.getInstance(s, SignatureSpi.class);
                      return getInstance(instance, algorithm);
                  } catch (NoSuchAlgorithmException e) {
                      failure = e;
                  }
              }
          } while (t.hasNext());
          throw failure;
      }
docs: Returns a Signature object that implements the specified signature
  algorithm.
  
  <p> This method traverses the list of registered security Providers,
  starting with the most preferred Provider.
  A new Signature object encapsulating the
  SignatureSpi 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 algorithm requested.
  See the Signature section in the <a href=
  "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature">
  Java Cryptography Architecture Standard Algorithm Name Documentation</a>
  for information about standard algorithm names.
  
  @return the new Signature object.
  
  @exception NoSuchAlgorithmException if no Provider supports a
  Signature implementation for the
  specified algorithm.
  
  @see Provider