private void swapTerms(int ind1, int ind2){
        if(ind1 != ind2){
            Term store = new Term(polynomial.get(ind1));
            polynomial.set(ind1, polynomial.get(ind2));
            polynomial.set(ind2, store);
        }
    }