Java Number Format Pattern getDataFormat(final boolean grouped, final boolean isFloat, int declen)

Here you can find the source of getDataFormat(final boolean grouped, final boolean isFloat, int declen)

Description

get Data Format

License

Apache License

Declaration

static final public String getDataFormat(final boolean grouped, final boolean isFloat, int declen) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {

    static final public String getDataFormat(final boolean grouped, final boolean isFloat, int declen) {
        DecimalFormat nf = new DecimalFormat();
        nf.setGroupingUsed(grouped);// w  w  w .  jav a2s.c  o  m

        if (!isFloat)
            declen = 0;
        nf.setMaximumFractionDigits(declen);
        nf.setMinimumFractionDigits(declen);
        return nf.toPattern();
    }
}

Related

  1. formatTokens(long tokens)
  2. formatValue(int value)
  3. formatValue(Object value)
  4. formatWith6Digits(String input)
  5. getBigDecimalFromString(String numericValue, String numberFormat)
  6. getDefaultDecimalFormat()
  7. getExponentialFormat(int precision)
  8. getF(String tStr, String formate)
  9. getFloatFormat()