Code example for Enumeration

Methods: hasMoreElements, nextElement

0
    private DHParameter( 
        ASN1Sequence  seq)
    { 
        Enumeration     e = seq.getObjects();
 
        p = ASN1Integer.getInstance(e.nextElement());
        g = ASN1Integer.getInstance(e.nextElement());
 
        if (e.hasMoreElements())
        { 
            l = (ASN1Integer)e.nextElement();
        } 
        else 
        { 
            l = null;
        } 
    } 
 
    public BigInteger getP()
    { 
        return p.getPositiveValue();