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만큼 의 소수점 자리로 반올림된다

+ Recent posts