DecimalFormat decimalFormat = new DecimalFormat("#.00");
System.out.println(decimalFormat.format(123.254));
System.out.println(decimalFormat.format(123.255));
输出:123.25
123.26
System.out.println(decimalFormat.format(123.254));
System.out.println(decimalFormat.format(123.255));
输出:123.25
123.26