http://blog.csdn.net/windone0109/article/details/5355379进一法: 即省略的位上只要大于零都要进一位 ; 
四舍五入法: 即省略的位上小于五都要舍去,但省略的位上满五都要进一位 ; 
还有一种 
去尾法: 即省略的位上不管是否满五都要舍去 ; 

1、除法带小数

例如:

  int a = 8;
  int b = 3;
  int c = ((double)la)/b;

  System.out.println(c);

系统打印:2.6666666666666665

2、进一法的实现

用Math.ceil()实现,例如Math.ceil(2.1),结果就是3.0

例如:

  int a = 8;
  int b = 3;
  int c = ((double)la)/b;

  int d = (int) Math.ceil(c);

  System.out.println(d);

系统打印:3

相关文章:

  • 2021-11-14
  • 2022-12-23
  • 2021-11-06
  • 2021-06-13
  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-02-01
  • 2022-12-23
相关资源
相似解决方案