Java BigInteger Calculate getIntegral(String number, BigInteger def)

Here you can find the source of getIntegral(String number, BigInteger def)

Description

Parse the given string into a big integer if possible otherwise return the specified default.

License

Open Source License

Declaration

public static BigInteger getIntegral(String number, BigInteger def) 

Method Source Code

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

import java.math.BigInteger;

public class Main {
    /**/*from  w  w w. j a  va  2  s .  co m*/
     * Parse the given string into a big integer if possible otherwise return
     * the specified default.
     */
    public static BigInteger getIntegral(String number, BigInteger def) {
        try {
            return new BigInteger(number);
        } catch (Exception e) {
            return def;
        }
    }
}

Related

  1. getDateOf(BigInteger fileTime)
  2. getDateOf(final BigInteger fileTime)
  3. getDigitCount(BigInteger number)
  4. getHexString(BigInteger bigInt)
  5. getHistogramBigInt(List data, int breaks)
  6. getInterfaceName(final BigInteger datapathid, final String portName, final Integer vlanId)
  7. getIpAddressByBigInteger(BigInteger[] bigs)
  8. getIpv4AddrFromNumber(BigInteger addr)
  9. getIpv6AddrFromNumber(BigInteger addr)