Here you can find the source of doubleToString(double value, int maximum, int minimum)
public static String doubleToString(double value, int maximum, int minimum)
//package com.java2s; import java.text.NumberFormat; public class Main { public static String doubleToString(double value, int maximum, int minimum) { NumberFormat nbf;/*from w ww .jav a 2 s. co m*/ nbf = NumberFormat.getNumberInstance(); nbf.setMaximumFractionDigits(maximum); nbf.setMinimumFractionDigits(minimum); nbf.setGroupingUsed(false); return nbf.format(value); } }