Here you can find the source of getBigInteger(Number value)
Parameter | Description |
---|---|
value | Number instance |
public static final BigInteger getBigInteger(Number value)
//package com.java2s; /*//from ww w .jav a2 s. c o m * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation; either version 2.1 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ import java.math.BigInteger; public class Main { /** * Utility method used to convert a Number into a BigInteger. * * @param value Number instance * @return BigInteger instance */ public static final BigInteger getBigInteger(Number value) { BigInteger result = null; if (value != null) { if (value instanceof BigInteger) { result = (BigInteger) value; } else { result = BigInteger.valueOf(Math.round(value.doubleValue())); } } return (result); } }