public static void main(String args[]) {
        double integral = 0;
        double sum = 0;
        double[] Xi = new double[2 * m + 1];
        Xi[0] = xi;
        double[] Yi = new double[2 * n + 1];
        Yi[0] = yi;
        for (int i = 1; i <= 2 * n; i++) {
            Xi[i] = Xi[i - 1] + hx;
        }
        for (int j = 1; j <= 2 * m; j++) {
            Yi[j] = Yi[j - 1] + hy;
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                sum += function(Xi[2 * i], Yi[2 * j]);
                sum += 4 * function(Xi[2 * i + 1], Yi[2 * j]);
                sum += function(Xi[2 * i + 2], Yi[2 * j]);
                sum += 4 * function(Xi[2 * i], Yi[2 * j + 1]);
                sum += 16 * function(Xi[2 * i + 1], Yi[2 * j + 1]);
                sum += 4 * function(Xi[2 * i + 2], Yi[2 * j + 1]);
                sum += function(Xi[2 * i], Yi[2 * j + 2]);
                sum += 4 * function(Xi[2 * i + 1], Yi[2 * j + 2]);
                sum += function(Xi[2 * i + 2], Yi[2 * j + 2]);
            }
        }

/*        for (int i = 0; i <= n - 1; i +=2) {
            for (int j = 0; j <= m-1; j +=2) {
                sum += function(Xi[i], Yi[j]);
            }
        }

        for (int i = 1; i <= n - 1; i += 2) {
            for (int j = 0; j <= m-1; j += 2) {
                sum += 4 * function(Xi[i], Yi[j]);
            }
        }

        for (int i = 2; i <= n - 1; i += 2) {
            for (int j = 0; j <= m-1; j += 2) {
                sum += function(Xi[i], Yi[j]);
            }
        }


        for (int i = 0; i <= n - 1; i += 2) {
            for (int j = 1; j <= m-1; j += 2) {
                sum += 4 * function(Xi[i], Yi[j]);
            }
        }

        for (int i = 1; i <= n - 1; i += 2) {
            for (int j = 1; j <= m-1; j += 2) {
                sum += 16 * function(Xi[i], Yi[j]);
            }
        }

        for (int i = 2; i <= n - 1; i += 2) {
            for (int j = 1; j <= m-1; j += 2) {
                sum += 4 * function(Xi[i], Yi[j]);
            }
        }

        for (int i = 0; i <= n - 1; i += 2) {
            for (int j = 2; j <= m-1; j += 2) {
                sum += function(Xi[i], Yi[j]);
            }
        }

        for (int i = 1; i <= n - 1; i += 2) {
            for (int j = 2; j <= m-1; j += 2) {
                sum += 4 * function(Xi[i], Yi[j]);
            }
        }

        for (int i = 2; i <= n - 1; i += 2) {
            for (int j = 2; j <= m-1; j += 2) {
                sum += function(Xi[i], Yi[j]);
            }
        }
*/
        integral += sum;
        integral *= (hx * hy / 9);
        System.out.println("Integral by CubeOfSimpson= " + integral);    //0.040822
    }