Mega Code Archive
Using the comma (,) flag to display numbers with thousands separator
public class MainClass
{
public static void main( String args[] )
{
System.out.printf( "%,d\n", 58625 );
System.out.printf( "%,.2f\n", 58625.21 );
System.out.printf( "%,.2f", 12345678.9 );
}
}
58,625
58,625.21
12,345,678.90