Java Fraction Format format(double number)

Here you can find the source of format(double number)

Description

format

License

Open Source License

Declaration

private static String format(double number) 

Method Source Code

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

import java.text.NumberFormat;

public class Main {
    private static String format(double number) {
        NumberFormat format = NumberFormat.getNumberInstance();
        format.setMaximumFractionDigits(2);
        format.setMinimumFractionDigits(0);
        format.setGroupingUsed(false);//from   ww  w  .  j  a  v a  2  s .  com
        return format.format(number);
    }
}

Related

  1. format(Double num)
  2. format(double num, int n)
  3. format(double num, String pattern)
  4. format(double number)
  5. format(double number)
  6. format(double number, int digits)
  7. format(double number, String fmt)
  8. format(double price)
  9. format(double val)