Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.math.BigInteger;

public class Main {
    public static final BigInteger castToBigInteger(Object paramObject) {
        if (paramObject == null) {
            return null;
        }
        if ((paramObject instanceof BigInteger)) {
            return (BigInteger) paramObject;
        }
        if (((paramObject instanceof Float)) || ((paramObject instanceof Double))) {
            return BigInteger.valueOf(((Number) paramObject).longValue());
        }
        String str = paramObject.toString();
        if (str.length() == 0) {
            return null;
        }
        return new BigInteger(str);
    }
}