Here you can find the source of renderDouble(double value, int precision)
public static String renderDouble(double value, int precision)
//package com.java2s; //License from project: LGPL import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; public class Main { public static String renderDouble(double value, int precision) { return renderDouble(value, precision, ','); }// w ww.j av a2s . com public static String renderDouble(double value, Locale locale) { NumberFormat f = NumberFormat.getInstance(locale); return f.format(value); } public static String renderDouble(double value, int precision, char sep) { String format = "#."; for (int i = 0; i < precision; i++) { format += "#"; } DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.ENGLISH); otherSymbols.setDecimalSeparator(sep); if (sep == ',') { otherSymbols.setGroupingSeparator('.'); } DecimalFormat df = new DecimalFormat(format, otherSymbols); return df.format(value); } }