Java Double to String doubleToString(double d)

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

Description

Erstellt aus einem double einen String.

License

Open Source License

Declaration

public static String doubleToString(double d) 

Method Source Code

//package com.java2s;
/*/*from www  .j  a  v a2  s.com*/
 * Created 20.07.2007
 *
 * This file is part of the project Alricg. The file is copyright
 * protected and under the GNU General Public License.
 * For more information see "http://www.alricg.de/".
 */

public class Main {
    /**
     * Erstellt aus einem double einen String. Dabei wird die Nachkommastelle nur 
     * angezeigt, wenn diese auch notwenig ist 
     */
    public static String doubleToString(double d) {
        if (d % 1 == 0) {
            return Integer.toString((int) d);
        } else {
            return Double.toString(d);
        }
    }
}

Related

  1. double2string(double doubledata)
  2. double2String(double[] v)
  3. doubleToStr(Double d)
  4. doubleToStr(Double valor)
  5. doubleToString(double d)
  6. doubleToString(double d)
  7. doubleToString(double d, int fNumber)
  8. doubleToString(double d, int sigDigs)
  9. doubleToString(Double doub)