使用 java.lang.Math 類。 round() 為四捨五入, ceil() 為無條件進位, floor() 為無條件捨去。 請見以下範例,注意 round() 的返回值型態為 long 。
確定! 回上一頁