// Method that checks for 2 decimal places in above function public boolean checkDecimalPlaces(double d, int decimalPlaces) { if (d == 0) return true; double multiplier = Math.pow(10, decimalPlaces); double check = d * multiplier; check = Math.round(check); check = check / multiplier; return (d == check); }