Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    public static final BigDecimal castToBigDecimal(Object paramObject) {
        if (paramObject == null) {
            return null;
        }
        if ((paramObject instanceof BigDecimal)) {
            return (BigDecimal) paramObject;
        }
        if ((paramObject instanceof BigInteger)) {
            return new BigDecimal((BigInteger) paramObject);
        }
        String str = paramObject.toString();
        if (str.length() == 0) {
            return null;
        }
        return new BigDecimal(str);
    }
}