Java Fraction Format formatDouble(DecimalFormat fmt, double value)

Here you can find the source of formatDouble(DecimalFormat fmt, double value)

Description

format Double

License

Open Source License

Declaration

public static String formatDouble(DecimalFormat fmt, double value) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {
    public static String formatDouble(DecimalFormat fmt, double value) {
        if (Double.isNaN(value)) {
            return "NaN";
        } else if (Double.isInfinite(value)) {
            if (value > 0) {
                return "+Inf";
            } else {
                return "-Inf";
            }/*from w w  w  .  j  a v  a2 s . c o m*/
        } else {
            return fmt.format(value);
        }
    }
}

Related

  1. formatDegToDms(double degrees, double min, double max)
  2. formatDisplay(Double value)
  3. formatDistance(float distance)
  4. formatDollarAmount(float amount)
  5. formatDoube(double val)
  6. formatDouble(Double amount, String format)
  7. formatDouble(double aValue)
  8. formatDouble(double d)
  9. formatDouble(Double d)