sqrt() 메서드
abs() 메서드
addExact() 메서드
cbrt() 메서드
ceil() 메서드
decrementExact() 메서드
floor() 메서드
floorDiv() 메서드
floorMod() 메서드
사인, 코사인, 탄젠트값 등을 구하는 메서드도 있지만 절대 활용하지 않을 것으로 사료됨..
또한, 산술연산자로도 동일한 결과를 낼 수 있지만,
정적메서드에 있고 예외처리도 되어 있기 때문에
효율성을 높이는 데 도움을 줄 수 있을 것으로 판단됨
// Math의 클래스 일부
int a = 100;
double b = 15.5;
float c = 15;
int d = 50;
long e = 150;
// sqrt() 메소드 - 제곱근(결과는 double형)
System.out.println(Math.sqrt(a)); // 10.0
System.out.println(Math.sqrt(b)); // 3.9370039370059056
System.out.println(Math.sqrt(c)); // 3.872983346207417
// abs() 메서드 - 절대값 구하기
System.out.println(Math.abs(a)); // 100
System.out.println(Math.abs(b)); // 15.5
System.out.println(Math.abs(c)); // 15.0
// addExact() - 더하기 : int long만 가능
System.out.println(Math.addExact(a,e)); // 250
// cbrt() - 세제곱근(결과는 double형)
System.out.println(Math.cbrt(e)); // 5.313292845913056
// ceil() - 올림, 매개변수는 double형만
System.out.println(Math.ceil(b)); // 16/0
// decrementExact() - 1빼기, 매개변수는 int나 long형만
System.out.println(Math.decrementExact(a)); //99
// floor() - 내림, 매개변수는 double형만
System.out.println(Math.floor(b)); //15.0
//floorDiv() - 몫구하기, a/d - int, long만
System.out.println(Math.floorDiv(a,d)); // 2
//floorMod() - 나머지 구하기 a%d - int, long만
System.out.println(Math.floorMod(a,d)); // 0
//hypot() - 빗변 구하기 - 숫자 자료형
System.out.println(Math.hypot(2,2)); // 2.8284271247461903