/**
 * Created with IntelliJ IDEA.
 */
public class PercolationStats {

    private double[] results;
    private int dimensionSize;
    private int times; //number of times, T, to repeat the percolation steps

    // perform T independent computational experiments on an N-by-N grid
    public PercolationStats(int N, int T) {

        if (N <= 0 || T <= 0) throw new IllegalArgumentException("N and T must be greater than 0");

        dimensionSize = N;
        times = T;
        results = new double[T];
    }

    // sample mean of percolation threshold
    public double mean() {
        return 0;
    }

    // sample standard deviation of percolation threshold
    public double stddev() {
        return 0;
    }

    // returns lower bound of the 95% confidence interval
    public double confidenceLo() {
        return 0;
    }

    // returns upper bound of the 95% confidence interval
    public double confidenceHi() {
        return 0;
    }

    public static void main(String[] args) {

        int N = Integer.parseInt(args[0]);
        int T = Integer.parseInt(args[1]);

        PercolationStats stats = new PercolationStats(N, T);
        stats.runSimulation();
    }

    private void runSimulation() {
        for (int t = 0; t < results.length; t++) {
            int count = 0;

            Percolation percolation = new Percolation(dimensionSize);
            while(!percolation.percolates()) {
                int i = StdRandom.uniform(1, dimensionSize + 1);
                int j = StdRandom.uniform(1, dimensionSize + 1);

                while(percolation.isOpen(i, j)) {
                    i = StdRandom.uniform(1, dimensionSize + 1);
                    j = StdRandom.uniform(1, dimensionSize + 1);
                }
                percolation.open(i,j);
                count++;

            }
            results[t] = ((double)count) / (dimensionSize * dimensionSize);
        }

    }
}

@@ -587,33 +587,54 @@
 %0A        return 
-0
+StdStats.mean(results)
 ;%0A    %7D%0A%0A    // 
@@ -720,33 +720,56 @@
 %0A        return 
-0
+StdStats.stddev(results)
 ;%0A    %7D%0A%0A    // 
@@ -1222,16 +1222,123 @@
 tion();%0A
+        System.out.println(%22mean=%22 + stats.mean());%0A        System.out.println(%22stdev=%22 + stats.stddev());%0A
     %7D%0A%0A 

Update PercolationStats.java