// math中的靜態方法
// 返回乙個數字的絕對值
console.log(math.abs(-1));
// 反余弦,根據余弦值得到弧度。
console.log(math.acos(0.5));
// 反正弦
console.log(math.asin(0.5));
// 反正切
console.log(math.atan(1));
// 正弦
console.log(math.sin(math.pi/2));
// 余弦
console.log(math.cos(math.pi/2));
// 正切
console.log(math.tan(math.pi/4));
// 向上取整: 返回大於或者等於引數的最小整數
console.log(math.ceil(-4.1));
// 向下取整: 返回小與或者等於引數的最大整數
console.log(math.floor(4.1));
// 四捨五入
console.log(math.round(-4.3));
console.log(math.round(-4.7));
// 指數操作
console.log(math.pow(2,3));//2的3次方
// 平方根
console.log(math.sqrt(4));//根號4
// 立方根
console.log(math.cbrt(8));//3次根
// 以10位底數的對數
console.log(math.log10(1000));
// 以2位底數的對數
console.log(math.log2(8));
//返回乙個[0,1)的隨機數。[20,30]==>[0,10]+20 [-30,30]==>[0,60]-30
console.log(math.random());
// 最大值
console.log(math.max(1,2,35,56));
// 最小值
console.log(math.min(1,2,54,8676));
陣列中的常見方法
arrays工具類裡重寫了object中的equals方法,比較的是陣列中的值 int arr1 newint int arr2 newint int arr3 newint system.out.println arrays.equals arr1,arr2 true system.out.pri...
Junit中的Assert常見方法
在靜態類junit.framework.assert或者靜態類org.junit.assert中存在以下幾個方法 1 assertequals a,b 方法,用來檢視物件中存的值是否是期待的值,與字串比較中使用的equals 方法類似 2 assertfalse 和asserttrue 方法,用來檢...
Python 中的 os 模組常見方法
os.remove 刪除檔案 os.rename 重新命名檔案 os.walk 生成目錄樹下的所有檔名 os.chdir 改變目錄 os.path.split 返回 dirname basename 元組 os.path.splitext 返回 filename,extension 元組 os.pa...