Java Locale Format formatDouble(double number)

Here you can find the source of formatDouble(double number)

Description

Formats double - show max 9 fraction digits

License

Open Source License

Parameter

Parameter Description
number double number to format

Return

string representation of double

Declaration

public static String formatDouble(double number) 

Method Source Code

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

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;

public class Main {
    /**/*from w  w w .j a v a  2 s. c  o  m*/
     * Formats double - show max 9 fraction digits
     *
     * @param number double number to format
     * @return string representation of double
     */
    public static String formatDouble(double number) {
        NumberFormat format = DecimalFormat.getInstance(Locale.US);
        format.setMaximumFractionDigits(9);
        format.setGroupingUsed(false);
        return format.format(number);
    }
}

Related

  1. formatDecimal(BigInteger b)
  2. formatDecimalDisplay(final double _numberToFormat, final String _formatToApply)
  3. formatDouble(double in)
  4. formatDouble(double inVal, int inDecs)
  5. formatDouble(Double localDouble, int scale)
  6. formatDouble(double v)
  7. formatDouble(double val, String format)
  8. formatDouble(Double valor, int decimal)
  9. formatDouble(double value)