public static void main(String[] args) {
        double integral = 0;
        double integralprev = 0;
        double sum = 0;

        do {

            iterCount++;

            integral = function(a) + function(b);
            xi = a;
            sum = 0;
            for (int i = 1; i < n; i++) {
                xi += h;
                sum += 2 * function(xi);
            }
            integral += sum;
            integral *= h / 2;

            h /= 2;
            n*=2;

            integralprev = function(a) + function(b);
            xi = a;
            sum = 0;
            for (int i = 1; i < n; i++) {
                xi += h;
                sum += 2 * function(xi);
            }
            integralprev += sum;
            integralprev *= h / 2;


        }
        while (Math.abs(integral - integralprev) >= eps * 3);

        System.out.println("Integral by Trapecii= " + integral + "Итераций: " + iterCount);
        MethodOfSimpson.MethodSimpson();
//      System.out.println("1.89818");
    }