Java BigDecimal from numberToBigDecimal(Object number)

Here you can find the source of numberToBigDecimal(Object number)

Description

number To Big Decimal

License

Open Source License

Declaration

public static BigDecimal numberToBigDecimal(Object number) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;

public class Main {
    public static BigDecimal numberToBigDecimal(Object number) {
        if (number == null) {
            return null;
        }//from   ww  w  . j  a v  a  2  s .  c o  m

        if (!(number instanceof Number)) {
            throw new IllegalArgumentException("Input object is not a number");
        }

        return new BigDecimal(((Number) number).toString());
    }
}

Related

  1. doubleToBigDecimal(double amountAsDouble)
  2. doubleToBigDecimal(double dd)
  3. longToBigDecimal(long amountAsSatoshis)
  4. numberToBigDecimal(Number number)
  5. numberToBigDecimal(Number value)
  6. numberToBigDecimal(Object obj)
  7. toBigDecimal(byte[] bytes)
  8. toBigDecimal(Double d)
  9. toBigDecimal(Double d)