Java Fraction Format format(float value)

Here you can find the source of format(float value)

Description

Formats a floating point value with useful default rules; ie.

License

Open Source License

Declaration

public static String format(float value) 

Method Source Code

//package com.java2s;

import java.text.NumberFormat;

public class Main {
    /** Used to easily format floats with sensible defaults. */
    protected static final NumberFormat _ffmt = NumberFormat.getInstance();

    /**/*  w ww. jav  a2  s .co  m*/
     * Formats a floating point value with useful default rules; ie. always display a digit to the
     * left of the decimal and display only two digits to the right of the decimal (rounding as
     * necessary).
     */
    public static String format(float value) {
        return _ffmt.format(value);
    }

    /**
     * Formats a floating point value with useful default rules; ie. always display a digit to the
     * left of the decimal and display only two digits to the right of the decimal (rounding as
     * necessary).
     */
    public static String format(double value) {
        return _ffmt.format(value);
    }
}

Related

  1. format(float f)
  2. format(Float f)
  3. format(float num)
  4. format(float number, int bitCount)
  5. format(float totalNumberOfFreeBytes)
  6. format(NumberFormat nf, float number, float defaultValue)
  7. format0(Double d)
  8. format2Double(Double amount)
  9. formatAmount(double amount)