Number formatting helps make your numbers more readable. : Number Format « Data Type « Java Tutorial

import java.text.NumberFormat;
import java.util.Locale;

public class MainClass {
  public static void main(String[] args) {
    NumberFormat nf = NumberFormat.getInstance(Locale.US);
  1. If you use Locale.Germany, you'll get a NumberFormat object that formats numbers according to the German locale.
  2. If you pass Locale.US, you get one for the US number format.
  3. The no-argument getInstance method returns a NumberFormat object with the user computer's locale.

2.14.Number Format
2.14.1.Number formatting helps make your numbers more readable.
2.14.2.Specifying Precision
2.14.3.Applied to strings, the precision specifier specifies the maximum field length
2.14.4.Illustrating the precision specifier
2.14.5.Add leading zeros to a number
2.14.8.NumberFormat: Minimum Integer Digits, Maximum/Minimum Fraction Digits
2.14.9.Number format with FieldPosition
2.14.11.A number formatter for logarithmic values. This formatter does not support parsing.
2.14.12.Format a percentage for presentation to the user
2.14.13.Get Percent Value
2.14.14.Helper class for format number and currency