These tips were developed using Java TM 2 SDK, Standard Edition, v 1.2.2, and are not guaranteed to work with other versions. Or perhaps you don't care about formatting, but you do care about making your application work in an international context. A couple of classes in the java.text package deal with these kinds of issues. In other words, different locales, in this case locales for the United States and for Germany, use different conventions for representing numbers. Then the format method is called to format a number according to the rules of a specific locale.
Internationalization is a big issue when formatting numbers.
Another is the ability to exercise fine control over formatting, for example, by specifying the number of decimal places. Parsing support is included in NumberFormat . The first part uses the default locale, the second the German locale. There's one final point to be covered in this discussion of formatting. In the examples above, DecimalFormat and NumberFormat are both used.