import java.text.NumberFormat;
import java.util.Locale;
public class MainClass{
public static void main(String[] argv){
Locale[] locales = { Locale.US, Locale.ITALY };
for (Locale loc:locales) {
NumberFormat f = NumberFormat.getInstance(loc);
String formattedNumber = f.format(111123456.78911);
System.out.format("%15s: %s\n", loc.getDisplayCountry(),
formattedNumber);
}
}
}
|