Java Double Number to String double2String(double value)

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

Description

double String

License

Open Source License

Declaration

public static String double2String(double value) 

Method Source Code

//package com.java2s;
/*  $Id: HBCIUtilsInternal.java,v 1.1 2011/05/04 22:37:47 willuhn Exp $

 This file is part of hbci4java//from w w  w  . j av a2s. co m
 Copyright (C) 2001-2008  Stefan Palme

 hbci4java is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 hbci4java is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

public class Main {
    public static String double2String(double value) {
        DecimalFormat format = new DecimalFormat("0.##");
        DecimalFormatSymbols symbols = format.getDecimalFormatSymbols();
        symbols.setDecimalSeparator('.');
        format.setDecimalFormatSymbols(symbols);
        format.setDecimalSeparatorAlwaysShown(false);
        return format.format(value);
    }
}

Related

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