[Java基础] Java float保留两位小数或多位小数
方法1:用Math.round计算,这里返回的数字格式的. float price=89.89; int itemNum=3; float totalPrice=price*itemNum; float num=(float)(Math.round(totalPrice*100)/100);//如果要求精确4位就*10000然后/10000 方法2:用DecimalFormat 返回的...
java float 保留二位小数
引用:http://blog.csdn.net/com_stu_zhang/article/details/7214565 方法1: float f = 34.232323; BigDecimal b = &n...
本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。
Java开发者
Java开发者成长课堂,课程资料学习,实战案例解析,Java工程师必备词汇等你来~
+关注