Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.math.BigDecimal;

public class Main {
    public static BigDecimal withObject(Object value) {
        if (value == null)
            return null;
        else if (value instanceof BigDecimal)
            return (BigDecimal) value;
        else if (value instanceof Double)
            return new BigDecimal((Double) value);
        else if (value instanceof Float)
            return new BigDecimal((Float) value);
        else if (value instanceof Integer)
            return new BigDecimal((Integer) value);
        else if (value instanceof Short)
            return new BigDecimal((Short) value);
        else
            return null;
    }
}