double n = 1.23456;
System.out.println(Math.round(n)); // result : 1
double n = 1.23456;
System.out.println(Math.round(n * 10)/10); // result : 1.2
double n = 1.23456;
System.out.println(Math.round(n * 100)/100); // result : 1.23
double n = 1.23456;
System.out.println(Math.round(n * 10000)/10000); // result : 1.2346
320x100
'프로그래밍 > Android-Java' 카테고리의 다른 글
[ANDROID] camera preview frame byte array to bitmap (0) | 2020.10.19 |
---|---|
[ANDROID] Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug' (0) | 2020.10.16 |
[ANDROID] Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $ (0) | 2020.10.16 |
[JAVA/Android] JNI proguard 난독화 (0) | 2020.09.23 |
[JAVA] list 내 원소 내림차순 정렬 (0) | 2020.09.07 |
댓글