Java BigDecimal Create getBigDecimal(Object number)

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

Description

get Big Decimal

License

Open Source License

Declaration

private static BigDecimal getBigDecimal(Object number) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://  w ww.j av a2 s  .c o m
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

import java.math.BigDecimal;

public class Main {
    private static BigDecimal getBigDecimal(Object number) {
        BigDecimal num = null;
        if (number instanceof BigDecimal) {
            num = (BigDecimal) number;
        } else {
            num = new BigDecimal(number.toString());
        }
        return num;
    }
}

Related

  1. getBigDecimal(double value, int decimals)
  2. getBigDecimal(final String str, final int scale)
  3. getBigDecimal(JsonObject object, String memberName)
  4. getBigDecimal(Map map, String attr)
  5. getBigDecimal(Number number)
  6. getBigDecimal(Object o)
  7. getBigDecimal(Object o)
  8. getBigDecimal(Object v, BigDecimal defaultValue)
  9. getBigDecimal(Object value)