Java Fraction Format formatNumber(double number, int decimal)

Here you can find the source of formatNumber(double number, int decimal)

Description

format Number

License

Apache License

Declaration

public static String formatNumber(double number, int decimal) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.NumberFormat;

public class Main {
    public static final NumberFormat NUM_FORMAT = NumberFormat
            .getInstance();

    public static String formatNumber(double number, int decimal) {
        NUM_FORMAT.setMaximumFractionDigits(decimal);
        NUM_FORMAT.setMinimumFractionDigits(decimal);
        return NUM_FORMAT.format(number).replace(",", "");
    }//from w  ww  . jav a 2s .  c  o  m
}

Related

  1. formatNumber(double i)
  2. formatNumber(double num)
  3. formatNumber(double num)
  4. formatNumber(double number)
  5. formatNumber(double number)
  6. formatNumber(double number, int val)
  7. formatNumber(Double number, String pattern)
  8. formatNumber(Double numberToFormat, int decimalPlacement)
  9. formatNumber(double paramDouble, int paramInt)