massTotal
is printing out as a number ending in ".0" no matter what the decimal should be. The massCounter[]
indexes are doubles. How do I make it round to the first decimal place, instead of to the whole number?
public static double massTotal(double[] massCounter) {
double massTotal = 0.0;
for (int i = 0; i < massCounter.length; i++) {
massTotal += Math.round(massCounter[i] * 10.0 / 10.0);
}
return massTotal;
}
Thanks!