Java Number Format numberFormat(String pattern, double value)

Here you can find the source of numberFormat(String pattern, double value)

Description

Returns an text with the value formatted.

License

Open Source License

Parameter

Parameter Description
pattern a parameter
value a parameter

Declaration

public static String numberFormat(String pattern, double value) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {
    /**//from  ww  w  .  j  ava  2 s.c  o  m
     * Returns an text with the value formatted. The possible pattern are:
     * 
     * @param pattern
     * @param value
     * @return
     */
    public static String numberFormat(String pattern, double value) {
        DecimalFormat myFormatter = new DecimalFormat(pattern);
        return myFormatter.format(value);
    }
}

Related

  1. numberFormat(int fractionDigits, Locale locale)
  2. numberFormat(int i)
  3. numberFormat(int num)
  4. numberFormat(Number number, String... pattern)
  5. numberFormat(String pattern, BigDecimal number)
  6. numberFormate(double num)
  7. numberFormatHelper(String string, double d)
  8. numberFormatter(String pattern, int maxDigits)