Java BigDecimal from toBigDecimal(Number price)

Here you can find the source of toBigDecimal(Number price)

Description

to Big Decimal

License

Open Source License

Declaration

public static BigDecimal toBigDecimal(Number price) 

Method Source Code


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

public class Main {
    public static BigDecimal toBigDecimal(Number price) {
        BigDecimal decimal;//from   w ww. j av a  2 s .  c o m
        if (price instanceof BigDecimal)
            decimal = (BigDecimal) price;
        else
            decimal = BigDecimal.valueOf(price.doubleValue());
        return decimal;
    }
}

Related

  1. toBigDecimal(Number number)
  2. toBigDecimal(Number number)
  3. toBigDecimal(Number number)
  4. toBigDecimal(Number number)
  5. toBigDecimal(Number number, int scale)
  6. toBigDecimal(Object n)
  7. toBigDecimal(Object obj)
  8. toBigDecimal(Object obj)
  9. toBigDecimal(Object object)