Here you can find the source of getNumberFormatInstanceFor2DecimalDigits()
public static NumberFormat getNumberFormatInstanceFor2DecimalDigits()
//package com.java2s; import java.text.NumberFormat; public class Main { public static NumberFormat getNumberFormatInstanceFor2DecimalDigits() { NumberFormat numberFormatFor2DecimalDigits = NumberFormat .getInstance();//from w w w . j a v a 2 s. c om numberFormatFor2DecimalDigits.setMaximumFractionDigits(2); return numberFormatFor2DecimalDigits; } }