java-math
Math
代码
package com.nash.java.pop.ch06_math;
public class MathApp {
/**
* Math 静态类方法
* @param args
*/
public static void main(String[] args) {
System.out.println("Math.max(2,10):\t " + Math.max(2,10));
System.out.println("Math.max(2.6,7.5):\t " + Math.max(2.6,7.5));
System.out.println("Math.abs(-100):\t " + Math.abs(-100));
System.out.println("Math.abs(-100.30):\t " + Math.abs(-100.30));
System.out.println("Math.acos(1):\t " + Math.acos(1));
System.out.println("Math.ceil(2.6):\t " + Math.ceil(2.6));
System.out.println("Math.floor(2.6):\t " + Math.floor(2.6));
System.out.println("Math.exp(Math.E):\t " + Math.exp(Math.E));
System.out.println("Math.min(2,10):\t " + Math.min(2,10));
System.out.println("Math.round(2.6):\t " + Math.round(2.6));
System.out.println("Math.random():\t " + Math.random());
}
}
结果
Math.max(2,10): 10
Math.max(2.6,7.5): 7.5
Math.abs(-100): 100
Math.abs(-100.30): 100.3
Math.acos(1): 0.0
Math.ceil(2.6): 3.0
Math.floor(2.6): 2.0
Math.exp(Math.E): 15.154262241479262
Math.min(2,10): 2
Math.round(2.6): 3
Math.random(): 0.05924174741095978
网友评论