๐ป
Java ํ๋ก๊ทธ๋๋ฐ - [๊ธฐ๋ณธ API ํด๋์ค] Math ํด๋์ค ๋ณธ๋ฌธ
KITRI/JAVA
Java ํ๋ก๊ทธ๋๋ฐ - [๊ธฐ๋ณธ API ํด๋์ค] Math ํด๋์ค
๋ํจ๋ 2020. 5. 13. 14:45๋ฉ์๋ | ์ค๋ช | ์์ ์ฝ๋ | ๋ฆฌํด๊ฐ |
int abs(int a) double abs(dobule a) |
์ ๋๊ฐ | int v1 = Math.abs(-5); double v2 = Math.abs(-3.14); |
v1 = 5 v2 = 3.14 |
double ceil(double a) | ์ฌ๋ฆผ๊ฐ | double v3 = Math.ceil(5.3); double v4 = Math.ceil(-5.3); |
v3 = 6.0; v4 = -5.0; |
double floor(double a) | ๋ฒ๋ฆผ๊ฐ | double v5 = Math.floor(5.3); double v6 = Math.floor(-5.3); |
v5 = 5.0 v6 = -6.0 |
int max(int a, int b) double max(double a, double b) |
์ต๋๊ฐ | int v7 = Math.max(5.9); double v8 = Math.max(5.3, 2.5); |
v7 = 9 v8 = 5.3 |
int min(int a, int b) double min(double a, double b) |
์ต์๊ฐ | int v9 = Math.min(5.9); double v10 = Math.min(5.3, 2.5); |
v9 = 5 v10 = 2.5 |
double random() | ๋๋ค๊ฐ | double v11 = Math.random(); | 0.0 <= v11 <= 1.0 |
double rint(double a) | ๊ฐ๊น์ด ์ ์์ ์ค์๊ฐ | double v12 = Math.rint(5.3); double v13 = Math.rint(5.7); |
v12 = 5 v13 = 6 |
long round(double a) | ๋ฐ์ฌ๋ฆผ๊ฐ | long v14 = Math.round(5.3); long v15 = Math.round(5.7); |
v14 = 5 v15 = 6 |
๋ฐ์ํ
'KITRI > JAVA' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Comments