Math類保留了所有用于幾何學(xué),三角學(xué)及幾種一般用途的浮點(diǎn)函數(shù).包括:三屆函數(shù),指數(shù)函數(shù),舍入函數(shù).比較常用到的有下面幾個(gè)方法:
floor(double arg) : 返回<=arg最大整數(shù).
max(x,y) : 返回x和y中的最大值.
round(arg) : 返回arg的只入不舍的最近整數(shù)值.
random() : 返回一個(gè)介于0與1之間的偽隨機(jī)數(shù).大多數(shù)情況下適應(yīng)Random類產(chǎn)生隨機(jī)數(shù).
toRadians(double angle) : 將角度轉(zhuǎn)換為弧度.
toDegrees(double angle) : 將弧度轉(zhuǎn)換為角度.