double 保留两位小数

用 Math.round。测试代码如下:

class round{
    public static void main(String args[]){
        double a = 123.13698;
        double roundOff = Math.round(a*100)/100.0;
        System.out.println(roundOff);  // 123.14
    }
}

参考:https://stackoverflow.com/questions/11701399/round-up-to-2-decimal-places-in-java