Java Double Number to String doubleToString(double value, int fractionDigits)

Here you can find the source of doubleToString(double value, int fractionDigits)

Description

double To String

License

Open Source License

Declaration

public static String doubleToString(double value, int fractionDigits) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DecimalFormat;

public class Main {
    public static String doubleToString(double value, int fractionDigits) {
        return doubleToString(value, 0, fractionDigits);
    }/* w  w  w . j  av  a2s .  c om*/

    public static String doubleToString(double value, int minFractionDigits, int maxFractionDigits) {
        DecimalFormat numberFormat = new DecimalFormat();
        numberFormat.setMinimumFractionDigits(minFractionDigits);
        numberFormat.setMaximumFractionDigits(maxFractionDigits);
        return numberFormat.format(value);
    }
}

Related

  1. doubleToString(double dnum)
  2. doubleToString(Double num)
  3. doubleToString(double val, int maxFractionDigits)
  4. doubleToString(double value)
  5. doubleToString(double value, int afterDecimalPoint)
  6. doubleToString(double value, int maximum, int minimum)
  7. doubleToString(double value, String format)
  8. doubleToString(final double d, final int decimalPlaces)
  9. doubleToString(final double number)