Java BigDecimal Format format2String(BigDecimal bd)

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

Description

format String

License

Apache License

Declaration

public static String format2String(BigDecimal bd) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {

    public static String format2String(BigDecimal bd) {
        if (bd != null) {
            bd = bd.setScale(2, RoundingMode.HALF_UP);
            return bd.toString();
        } else {/*from w w w. jav a 2 s .  co  m*/
            return null;
        }
    }
}

Related

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