Java BigDecimal to String bigDecimaltoString(BigDecimal bd)

Here you can find the source of bigDecimaltoString(BigDecimal bd)

Description

big Decimalto String

License

Open Source License

Declaration

public static String bigDecimaltoString(BigDecimal bd) 

Method Source Code

//package com.java2s;
/**//from  ww w . j  a v  a 2s  .  c o m
 * @author David Garratt
 * 
 * Project Name : Commander4j
 * 
 * Filename     : JUtility.java
 * 
 * Package Name : com.commander4j.util
 * 
 * License      : GNU General Public License
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * http://www.commander4j.com/website/license.html.
 * 
 */

import java.math.BigDecimal;

import java.text.NumberFormat;

public class Main {
    public static String bigDecimaltoString(BigDecimal bd) {
        String result = "";
        NumberFormat nf1 = NumberFormat.getInstance();

        nf1 = NumberFormat.getInstance();
        nf1.setMinimumFractionDigits(3);
        nf1.setMaximumFractionDigits(3);
        result = nf1.format(bd);

        return result;
    }
}

Related

  1. bigDecimal2String(BigDecimal value)
  2. bigDecimal2String(BigDecimal value)
  3. bigDecimalToString(BigDecimal number)
  4. print(String tag, BigDecimal[][] a)