Here you can find the source of formatDouble(double number)
Parameter | Description |
---|---|
number | double number to format |
public static String formatDouble(double number)
//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); } }