Java BigDecimal Format format(BigDecimal num)

Here you can find the source of format(BigDecimal num)

Description

format

License

Open Source License

Declaration

public static String format(BigDecimal num) 

Method Source Code


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

import java.math.BigDecimal;
import java.text.NumberFormat;

public class Main {
    public static String format(BigDecimal num) {

        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(100);
        nf.setMinimumFractionDigits(0);/*from www.j  a va2  s .co m*/
        nf.setGroupingUsed(false);
        return nf.format(num).replace(",", "."); // also replace fraction separator to '.' dot for different locales
    }
}

Related

  1. format(BigDecimal n, int prec)
  2. format(BigDecimal n, int prec)
  3. format(BigDecimal no, String formatter)
  4. format(BigDecimal num)
  5. format(BigDecimal num)
  6. format(BigDecimal number, String format)
  7. format(final BigDecimal bd)
  8. format(Object value, Integer precision)
  9. format(String pattern, final double secondInDouble)