Java Fraction Format format(float f)

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

Description

format

License

Open Source License

Declaration

public static String format(float f) 

Method Source Code


//package com.java2s;
//License from project: GNU General Public License 

import java.text.NumberFormat;

public class Main {
    private static NumberFormat numberFormat = NumberFormat.getInstance();

    public static String format(float f) {
        numberFormat.setMaximumFractionDigits(2);
        return numberFormat.format(f);
    }//from   w ww .ja  va2s .  c om
}

Related

  1. format(final double d)
  2. format(final double number)
  3. format(final double value)
  4. format(final double value, final int decimalPlaces)
  5. format(final NumberFormat fmt, final double val)
  6. format(Float f)
  7. format(float num)
  8. format(float number, int bitCount)
  9. format(float totalNumberOfFreeBytes)