0

Hello,

I'm trying to calculate the maximum and minimum distance between 10 points. My method to calculate the maximum distance is working fine however my method to calculate the minimum is returning 0.0 and I'm not sure why. Could someone please take a look at my code and tell me what I have missed? The only difference between my max and min methods is the greater than and less than within the if statement.

```
public static double min(double[] x, double[] y, double[] z) {
double distance[] = new double[45];
double minDistance = 0;
int count = 0;
for (int i = 0; i < 10; i++) {
for (int j = i + 1; j < 10; i++) {
distance[count] = Math.sqrt(Math.pow(x[i] - x[j], 2) + Math.pow(y[i] - y[j], 2) + Math.pow(z[i] - z[j], 2));
if (distance[count]) < minDistance) {
minDistance = distance[count];
}
}
}
return minDistance;
}
```