// Rounding to an integer: long n = Math.round(d); double d = Math.rint(d); // Rounding to two decimal places: long n = Math.round(d *100.); /* keep as "pennies" */ double d = Math.rint (d *100.)/100.;