Format specifier

A format specifier can have up to five different parts (not including the “%”). Everything in brackets [ ] below is optional, so only the percent (%) and the type are required. But the order is also mandatory, so any parts you DO use must go in this order.

아무거나

Btw, although type is the only required specifier, remember that if you do put in anything else, type must always come last!

아무거나

For example,

int one = 100000;
double two = 100000.2489;
String s = String.format("Rank is %,d out of %,.2f",one, two);
//output is :Rank is 100,000 out of 100,000.25