Java 兩個數相除,只要有小數就入一位,不捨去,即爲向上去整

向上取整用Math.ceil(double a) 向下取整用Math.floor(double a) 例如: System.out.println(Math.ceil(1.21)); System.out.println(Math.ceil(1.21)); 結果: 2.0; 1.0;
相關文章
相關標籤/搜索