public static Polynomial rootsToPoly(double[] roots){
            if(roots==null)return null;

            int pdeg = roots.length;

            double[] rootCoeff = new double[2];
            rootCoeff[0] = -roots[0];
            rootCoeff[1] = 1.0;
            Polynomial rPoly = new Polynomial(rootCoeff);
            for(int i=1; i<pdeg; i++){
                    rootCoeff[0] = -roots[i];
                    Polynomial cRoot = new Polynomial(rootCoeff);
                    rPoly = rPoly.times(cRoot);
            }
            return rPoly;
        }