Java Fraction Format formatAmount(double amount)

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

Description

format Amount

License

Open Source License

Declaration

public static String formatAmount(double 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 www .j a  v  a2  s .com*/
        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(float totalNumberOfFreeBytes)
  2. format(float value)
  3. format(NumberFormat nf, float number, float defaultValue)
  4. format0(Double d)
  5. format2Double(Double amount)
  6. formatAmount(Double amount)
  7. formatAmount(double number)
  8. formatAmount(final double mark)
  9. formatAnotherString(double valor)