public class JavaApplication1
{
public static void main(String[] args)
{
try
{
System.out.printf( "%,d\n", 199);
System.out.printf( "%,d\n", 1234);
System.out.printf( "%,d\n", 100000000);
System.out.printf( "%,d\n", -10000000);
System.out.printf( "%,.2f\n", 12345.31 );
System.out.printf( "%,.2f\n", 12345678.97 );
}
catch (Exception e)
{
System.out.println(e.toString());
}
}
}
/*
run:
199
1,234
100,000,000
-10,000,000
12,345.31
12,345,678.97
*/