本帖最后由 Ray丶少年 于 2015-4-28 08:15 编辑
我的思路是:将该数乘以100后四舍五入,再除以100即可- package day.day1;
- public class Demo {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- double num = 3.2355;
- long num1 = Math.round(num*100);
-
- double b = num1;
- b = b/100;
- System.out.println(b);
- }
- }
复制代码
|