code: public static KeyPairGenerator newKeyPairGenerator(final String algorithm, final int keySize)
  		throws NoSuchAlgorithmException, NoSuchProviderException
  	{
  		KeyPairGenerator generator;
  		if ("EC".equals(algorithm))
  		{
  			generator = KeyPairGenerator.getInstance(algorithm, "BC");
  		}
  		else
  		{
  			generator = KeyPairGenerator.getInstance(algorithm);
  			generator.initialize(keySize);
  		}
  		return generator;
  	}
docs: Factory method for creating a new {@link KeyPairGenerator} from the given parameters.
  
  @param algorithm
  the algorithm
  @param keySize
  the key size
  @return the new {@link KeyPairGenerator} from the given parameters
  
  @throws NoSuchAlgorithmException
  is thrown if no Provider supports a KeyPairGeneratorSpi implementation for the
  specified algorithm
  @throws NoSuchProviderException
  is thrown if the specified provider is not registered in the security provider
  list