sitelink1 | |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
http://cafe.naver.com/phonbell/9713
/*
1,234,567,890
123.142
*/
·미리보기 | 소스복사·
- import java.text.*;
- class NumberFormatTest
- {
- public static void main(String[] args) throws Exception {
- long l = 1234567890;
- double d = 123.141592;
- DecimalFormat df = new DecimalFormat("#,###"); // 세자리 마다 ','를 추가
- DecimalFormat df2 = new DecimalFormat("#.000"); // 소수점 셋째자리까지만 표현
- System.out.println(df.format(l));
- System.out.println(df2.format(d));
- }
- }
/*
1,234,567,890
123.142
*/