Here you can find the source of toFixedString(Locale locale, double value, int precision)
public static String toFixedString(Locale locale, double value, int precision)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { public static String toFixedString(Locale locale, double value, int precision) { NumberFormat nf = NumberFormat.getInstance(locale); int current = nf.getMaximumFractionDigits(); nf.setMaximumFractionDigits(precision); String ans = nf.format(value); nf.setMaximumFractionDigits(current); return ans; }//from www . j av a 2s . com }