public void multiply(Polynomials p){
        Polynomials p1 = new Polynomials("");
        Polynomials p2 = new Polynomials("");
        ListIterator lIt1 = polynomial.listIterator();
        if(lIt1.hasNext()){
            Term t1 = new Term((Term)lIt1.next());
            ListIterator lIt2 = p.polynomial.listIterator();
            while(lIt2.hasNext()){
                Term t2 = new Term((Term)lIt2.next());
                t2.factor = t2.factor * t1.factor;
                t2.power = t2.power + t1.power;
                p1.polynomial.add(t2);
            }
        }
        while(lIt1.hasNext()){
            Term t1 = new Term((Term)lIt1.next());
            ListIterator lIt2 = p.polynomial.listIterator();
            while(lIt2.hasNext()){
                Term t2 = new Term((Term)lIt2.next());
                t2.factor = t2.factor * t1.factor;
                t2.power = t2.power + t1.power;
                p2.polynomial.add(t2);
            }
            p1.add(p2);
        }
        polynomial = p1.polynomial;
    }