I am trying to get a double (resulting from a fraction of two int) as a return value of my following function.

```
public static double getThresHold(int n) {

    int i, j;
    int openSites = 0;
    Percolation percolation = new Percolation(n);
    do {
        i = StdRandom.uniform(n) + 1;
        j = StdRandom.uniform(n) + 1;
        if ( !percolation.isOpen(i, j) ) {
            percolation.open(i, j);
            openSites++;
        }
    } while (!percolation.percolates());

    double threshold = openSites * 1.0 / n*n;
    return threshold;
}

```

but the result is always wrong, I get value such as:

```
200.0
240.0
260.0

```

The expected result should be between `0.6` and `0.5`

What is wrong with my code !

Thanks.