FileDocCategorySizeDatePackage
NumFormat.javaAPI DocExample649Sat Nov 25 12:56:04 GMT 2000None

NumFormat

public class NumFormat extends Object
JDK1.1 introduced a series of Formatting classes that format various items in locale-appropriate ways (10000 becomes 10,000 or 10.000 or whatever, as needed in various locales. This program shows some simple ways of using it; for more, see JavaDoc on java.util.Locale and java.text.NumberFormat.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] av)

		int data[] = { 100, 1000, 10000, 1000000 };
		NumberFormat nf = NumberFormat.getInstance(Locale.US);
		for (int i = 0; i < data.length; ++i) {
			System.out.println(data[i] + "\t" + nf.format(data[i]));
		}