DecimalFormat: #表示 這一位存在則顯示,不存在則不顯示。0:表示如果已存在則顯示,如果不存在則顯示爲0
DecimalFormat df = new DecimalFormat(#0.00);
df.format(數字);
Math.ceil():上取整
Math.floor ():下取整
Math.round(): 四捨五入
Random.nextInt(100),從0到100 包括零 但不包括100
random.nextDouble(1),從0到1之間的隨機小數。
DecimalFormat: #表示 這一位存在則顯示,不存在則不顯示。0:表示如果已存在則顯示,如果不存在則顯示爲0
DecimalFormat df = new DecimalFormat(#0.00);
df.format(數字);
Math.ceil():上取整
Math.floor ():下取整
Math.round(): 四捨五入
Random.nextInt(100),從0到100 包括零 但不包括100
random.nextDouble(1),從0到1之間的隨機小數。