Here you can find the source of getNumberFormat(int maximumFractionDigits)
public static NumberFormat getNumberFormat(int maximumFractionDigits)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { /** Return a number formatter with maximum fraction digits, no grouping, locale ENGLISH. */ public static NumberFormat getNumberFormat(int maximumFractionDigits) { NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH); format.setMaximumFractionDigits(maximumFractionDigits); format.setGroupingUsed(false);//from ww w . ja v a2 s . c om return format; } }