The important thing in life is to have a great aim , and the determination

          常用鏈接

          統計

          IT技術鏈接

          保險相關

          友情鏈接

          基金知識

          生活相關

          最新評論

          JAVA實現四舍五入的方法

          Java實現四舍五入方法

           

          方法一 : 

          double source = 3.129;

          java.text.DecimalFormat df = new java.text.DecimalFormat("#.00");   // 保留小數點后兩位   

          String aveprice=df.format(source);     

           

          方法二 : 

          double source = 3.129;

          BigDecimal bd = new BigDecimal(source);

          bd.setScale(2,BigDecimal.ROUND_HALF_EVEN).floatValue() ;  // 保留小數點后兩位

          posted on 2008-10-30 15:37 鴻雁 閱讀(410) 評論(0)  編輯  收藏 所屬分類: IT技術相關

          主站蜘蛛池模板: 淳安县| 县级市| 吉隆县| 卢湾区| 确山县| 庆安县| 商洛市| 黎城县| 利辛县| 敦煌市| 平山县| 额尔古纳市| 城市| 黎城县| 永和县| 阳原县| 鹤峰县| 遂溪县| 利川市| 射阳县| 滦平县| 留坝县| 滨州市| 乃东县| 乐清市| 且末县| 马鞍山市| 汪清县| 富顺县| 迭部县| 衢州市| 南投市| 化州市| 大城县| 华安县| 双牌县| 谷城县| 陇南市| 东乌| 邯郸县| 五大连池市|