Java Fraction Format formatDouble(double d)

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

Description

format Double

License

Open Source License

Declaration

public static String formatDouble(double d) 

Method Source Code

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

import java.math.RoundingMode;

import java.text.DecimalFormat;

public class Main {
    public static String formatDouble(double d) {
        DecimalFormat formatter = new DecimalFormat("#0.00");
        formatter.setRoundingMode(RoundingMode.HALF_UP);
        return formatter.format(d);
    }/*from  w  ww.ja  v a 2  s .c o m*/
}

Related

  1. formatDouble(double d)
  2. formatDouble(double d)
  3. formatDouble(Double d)
  4. formatDouble(Double d)
  5. formatDouble(double d)
  6. formatDouble(Double d)
  7. formatDouble(double d, int maximumFractionDigits)
  8. formatDouble(Double d, NumberFormat format)
  9. formatDouble(Double doubleValue)