Java BigDecimal to convertToBigDecimal(Object sourceValue)

Here you can find the source of convertToBigDecimal(Object sourceValue)

Description

convert To Big Decimal

License

Apache License

Declaration

public static BigDecimal convertToBigDecimal(Object sourceValue) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {
    public static BigDecimal convertToBigDecimal(Object sourceValue) {
        if (sourceValue instanceof Number) {
            return new BigDecimal(((Number) sourceValue).toString());
        } else if (sourceValue instanceof String) {
            return new BigDecimal((String) sourceValue);
        }/*from   w ww .ja v  a2s  . c om*/

        return null;
    }
}

Related

  1. convertRadiansToDegrees(BigDecimal radians)
  2. convertRating(BigDecimal rating)
  3. convertSecondsToMillis(BigDecimal seconds)
  4. convertStringToBigDecimal(String strValue)
  5. convertToBigDecimal(final Object o)
  6. convertToBigDecimal(String s)
  7. convertToBigDecimal(String val)
  8. convertToBigDecimal(String value)
  9. convertToBigDecimal(String value)