properly round a double to two decimal places in java
/* rounds a double to two decimals accurately */
private static double twoDecimals(double numberToTrim){
boolean addOne = ((numberToTrim*100.0-(int)(numberToTrim*100.0)) >= 0.5);
double output = ((int)(numberToTrim*100))/100.0;
if(addOne){
output+=0.1;
}
return output;
}