Java Fraction Format formatNumber(Double number, String pattern)

Here you can find the source of formatNumber(Double number, String pattern)

Description

format Number

License

Open Source License

Declaration

public static String formatNumber(Double number, String pattern) 

Method Source Code


//package com.java2s;
import java.text.DecimalFormat;

public class Main {

    public static String formatNumber(Double number, String pattern) {
        DecimalFormat df = new DecimalFormat(pattern);
        return df.format(number);
    }//from  www.j  a va 2 s  . com

    public static String formatNumber(Float number, String pattern) {
        DecimalFormat df = new DecimalFormat(pattern);
        return df.format(number);
    }

    public static String formatNumber(Integer number, String pattern) {
        DecimalFormat df = new DecimalFormat(pattern);
        return df.format(number);
    }
}

Related

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