Java BigDecimal Create bigDecimal(Object object)

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

Description

big Decimal

License

Apache License

Declaration

public static BigDecimal bigDecimal(Object object) 

Method Source Code

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

import java.math.BigDecimal;

public class Main {

    public static BigDecimal bigDecimal(Object object) {
        if (object == null) {
            throw new NullPointerException();
        }//w  ww.  j av  a2  s  .c  o m
        BigDecimal result;
        try {
            result = new BigDecimal(String.valueOf(object).replaceAll(",",
                    ""));
        } catch (NumberFormatException e) {
            throw new NumberFormatException("Please give me a numeral.Not "
                    + object);
        }
        return result;
    }
}

Related

  1. bigDecimal(Number num)
  2. bigDecimalFromBytes(byte[] decimalBytes, int scale)
  3. bigDecimalFromString(String s)
  4. bigDecimalValue(final Number number)
  5. bigDecimalValueOf(Number n)