Java BigDecimal from toBigDecimal(Object object)

Here you can find the source of toBigDecimal(Object object)

Description

to Big Decimal

License

Open Source License

Declaration

public static BigDecimal toBigDecimal(Object object) 

Method Source Code


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

public class Main {
    public static BigDecimal toBigDecimal(Object object) {
        if (object == null) {
            return new BigDecimal(0);
        } else {/* w w  w .  j a v a2 s . c o m*/
            return new BigDecimal(object.toString());
        }
    }

    public static String toString(BigDecimal num) {
        if (num == null) {
            return "0";
        } else {
            return num.setScale(2).toString();
        }
    }
}

Related

  1. toBigDecimal(Number number, int scale)
  2. toBigDecimal(Number price)
  3. toBigDecimal(Object n)
  4. toBigDecimal(Object obj)
  5. toBigDecimal(Object obj)
  6. toBigDecimal(Object val)
  7. toBigDecimal(Object value)
  8. toBigDecimal(Object value)
  9. toBigDecimal(String _str)