Java Double Number to String double2String(double d)

Here you can find the source of double2String(double d)

Description

double String

License

Open Source License

Declaration

public static String double2String(double d) 

Method Source Code

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

import java.text.NumberFormat;

import java.util.Locale;

public class Main {
    public static String double2String(double d) {
        return (double2String(d, 5));
    }//ww  w .j  av  a2 s  .c  o  m

    public static String double2String(double d, int prec) {
        NumberFormat numberFormatter = NumberFormat
                .getNumberInstance(Locale.GERMAN);
        numberFormatter.setMaximumFractionDigits(prec);
        String res = numberFormatter.format(d);
        return (res);
    }
}

Related

  1. double2String(double value)
  2. doublesToStrings(final double... numbers)
  3. doubleToAtLeastString(double d, int length)
  4. doubleToCoreString(double number)