Java BigDecimal Format formatAmount(BigDecimal amount)

Here you can find the source of formatAmount(BigDecimal amount)

Description

format Amount

License

Open Source License

Declaration

public static String formatAmount(BigDecimal amount) 

Method Source Code


//package com.java2s;

import java.math.BigDecimal;

import java.text.NumberFormat;

public class Main {

    public static String formatAmount(double amount) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(0);//from w w w . j  a v a  2s .co  m
        nf.setGroupingUsed(false);
        return nf.format(amount);
    }

    public static String formatAmount(BigDecimal amount) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(0);
        nf.setGroupingUsed(false);
        return nf.format(amount);
    }
}

Related

  1. format(Object value, Integer precision)
  2. format(String pattern, final double secondInDouble)
  3. format2Scale(BigDecimal obj)
  4. format2String(BigDecimal bd)
  5. format_BigDecimal(BigDecimal decimal, Integer scale)
  6. formatAmount(BigDecimal amount)
  7. formatAmount(final BigDecimal number)
  8. formatAsReadable(BigDecimal number)
  9. formatBetrag(BigDecimal bdBetrag, Locale locale)