Code example for InvalidParameterException

0
            int             strength,
            SecureRandom    random)
        { 
            if (strength < 512 || strength > 1024 || strength % 64 != 0)
            { 
                throw new InvalidParameterException("strength must be from 512 - 1024 and a multiple of 64");
            } 
 
            this.strength = strength;
            this.random = random;
        } 
 
        public void initialize( 
            AlgorithmParameterSpec  params,
            SecureRandom            random)
            throws InvalidAlgorithmParameterException 
        { 
            if (!(params instanceof DSAParameterSpec))
            { 
                throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
            }