Code example for InvalidAlgorithmParameterException

            SecureRandom            random)
            throws InvalidAlgorithmParameterException 
            if (!(params instanceof DSAParameterSpec))
                throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
            DSAParameterSpec     dsaParams = (DSAParameterSpec)params;
            param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
            initialised = true;
        public KeyPair generateKeyPair()
            if (!initialised)
                DSAParametersGenerator   pGen = new DSAParametersGenerator();
Connect your IDE to all the code out there  Get Codota for Java