Java Number Format Pattern getDefaultDecimalFormat()

Here you can find the source of getDefaultDecimalFormat()

Description

Gets a default decimal format that should be used for formatting decimal values.

License

Open Source License

Return

A default decimal format.

Declaration

public static DecimalFormat getDefaultDecimalFormat() 

Method Source Code


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

import java.text.*;

public class Main {
    /**/*from w w w  . j a v  a 2  s.  com*/
     * Gets a default decimal format that should be used for formatting decimal values.
     *
     * @return A default decimal format.
     */
    public static DecimalFormat getDefaultDecimalFormat() {
        final DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols();
        decimalFormatSymbols.setDecimalSeparator('.');
        final DecimalFormat format = new DecimalFormat("#0.000", decimalFormatSymbols);
        format.setGroupingUsed(false);
        return format;
    }
}

Related

  1. formatValue(int value)
  2. formatValue(Object value)
  3. formatWith6Digits(String input)
  4. getBigDecimalFromString(String numericValue, String numberFormat)
  5. getDataFormat(final boolean grouped, final boolean isFloat, int declen)
  6. getExponentialFormat(int precision)
  7. getF(String tStr, String formate)
  8. getFloatFormat()
  9. getFormat()