Math クラス

各種計算で重宝するクラス。
「Math.」+「定数 or メソッド」
// 例
double y = Math.sin( Math.PI );

java.lang.Math

【定数】
static double	E	自然対数の底e
static double	PI	円周率

【メソッド】
static int	abs(int a) 絶対値を返す long, float, double も使える
static int	max(int a, int b) 大きいほうを返す long, float, double も使える
static int	min(int a, int b) 小さいほうを返す long, float, double も使える
static double	random() 0.0~1.0未満の乱数を返す
static double	floor(double a) 小数点以下切り捨て 例)4.3→4.0 -1.8→-2.0
		int型にしたいときは floor() を使わずキャストする。キャストだと -1.8→-1
static long	round(double a) 四捨五入して long を返す
static int	round(float a) 四捨五入して int を返す
static double	signum(double d) dがゼロなら 0.0 負なら -1.0 正なら 1.0 を返す
static double	pow(double a, double b) aのb乗を返す
static double	sqrt(double a) aの平方根を返す
static double	sin(double a) aラジアンのサインを返す(ラジアンは1周360°で 2*PI
static double	cos(double a) コサイン
static double	tan(double a) タンジェント
static double	atan2(double y, double x) 原点から(x,y)のラジアンを返す
static double	log(double a) aの自然対数を返す
static double	exp(double a) eのa乗を返す
import は必要ない。どこからでも使用できる。