updated version of PercolationStats.java