/** * @author lautturi.com * Java example: round off double to 2 decimal places */ import java.util.*; public class Lautturi { public static void main(String[] args) { double num = 123.4567; double roundOff = (double)Math.round(num*100)/100; System.out.println(roundOff); } }
output:
123.46