Java BigDecimal to toString(BigDecimal num)

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

Description

to String

License

Open Source License

Declaration

public static String toString(BigDecimal num) 

Method Source Code


//package com.java2s;
import java.math.BigDecimal;

public class Main {
    public static String toString(BigDecimal num) {
        if (num == null) {
            return "0";
        } else {// w ww  . j  ava 2 s  .  c  o  m
            return num.setScale(2).toString();
        }
    }
}

Related

  1. toNumber(final BigDecimal bigDecimal, final Class clazz)
  2. toObject(BigDecimal value)
  3. toPercent(final BigDecimal decimalValue, final MathContext mathCntext)
  4. toScientificNotation(BigDecimal bd)
  5. toSimpleBigDecimal(Object num)
  6. toString(BigDecimal value, int numberDecimalPlaces)
  7. toString(final BigDecimal dec)
  8. toUnsignedString(BigDecimal bigDecimal, int shift)