import java.text.*;
public class Test
{
public Test(double str, int b)
{
String c = "###,###";
if( b != 0)
{
c = c+".";
for(int i=0;i<b;i++)
{
c = c+"#";
}
}
// DecimalFormat fd = new DecimalFormat("###,###.####");
DecimalFormat fd = new DecimalFormat(c);
String fdVal = fd.format(str);
System.out.println(fdVal);
}
public static void main(String[] args) throws ParseException
{
Test t = new Test(2222222222998.61295, 0);
}
}
//// b만큼 의 소수점 자리로 반올림된다
'IT > Language' 카테고리의 다른 글
[JSP] 한글 이름 파일 다운로드 (0) | 2007.06.29 |
---|---|
[JAVA] javac, java 명령어의 옵션 (0) | 2007.06.29 |
[JAVA] 날짜 구하기 팁 (0) | 2007.06.29 |
[JAVA] 문자열중에 한글체크하기 정말 쉬워요. - getType (0) | 2007.06.29 |
[JAVA] ResultSet 에 대한 레코드 건수 알아내기 (0) | 2007.06.29 |