1. 程式人生 > >Math.ceil向上取整

Math.ceil向上取整



public class T {
    public static void main(String []args) {

        int bidCount=52;

         double ceil = bidCount / 5;

         double temp = Math.ceil(ceil);

         System.out.println("temp=" + temp);

        ceil = bidCount / 5.0;

        System.out.println("ceil=" + ceil);

        temp = Math.ceil(ceil);

        System.out
.println("temp=" + temp); } }

結果

temp=10.0
ceil=10.4
temp=11.0