Java BigDecimal Format formatNumberByMaxFracUseGrp(BigDecimal number, int val)

Here you can find the source of formatNumberByMaxFracUseGrp(BigDecimal number, int val)

Description

format Number By Max Frac Use Grp

License

Open Source License

Declaration

public static String formatNumberByMaxFracUseGrp(BigDecimal number, int val) 

Method Source Code


//package com.java2s;

import java.math.BigDecimal;

import java.text.NumberFormat;

public class Main {

    public static String formatNumberByMaxFracUseGrp(BigDecimal number, int val) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(val);
        nf.setGroupingUsed(true);//from w ww.  j  a va2 s. co  m
        return nf.format(number);
    }
}

Related

  1. formatMoney(long value)
  2. formatNoDecimalPoint(double amt)
  3. formatNumber(double number)
  4. formatNumber(String format, BigDecimal number)
  5. formatNumberByMaxFrac(BigDecimal number, int val)
  6. formatNumberCroreFormat(final BigDecimal num)
  7. formatNumberDouble(Double amount, int scale)
  8. formatNumberStr(String numberStr, Integer scale)
  9. formatNumer(BigDecimal value, int decimalPlaces, Locale locale, boolean roundCommercial)