Java BigInteger Create toBigInteger(final Integer i)

Here you can find the source of toBigInteger(final Integer i)

Description

Null save convert of a Integer to a BigInteger .

License

Open Source License

Parameter

Parameter Description
i the Integer to convert.

Return

the .

Declaration

public static BigInteger toBigInteger(final Integer i) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2014, 2015 QPark Consulting  S.a r.l.
 * //from   www. ja  va 2s .co  m
 * This program and the accompanying materials are made available under the 
 * terms of the Eclipse Public License v1.0. 
 * The Eclipse Public License is available at 
 * http://www.eclipse.org/legal/epl-v10.html.
 ******************************************************************************/

import java.math.BigInteger;

public class Main {
    /**
     * Null save convert of a {@link Integer} to a {@link BigInteger}.
     *
     * @param i
     *            the {@link Integer} to convert.
     * @return the {@link BigInteger}.
     */
    public static BigInteger toBigInteger(final Integer i) {
        if (i != null) {
            return BigInteger.valueOf(i);
        } else {
            return null;
        }
    }

    /**
     * Null save convert of a {@link Short} to a {@link BigInteger}.
     *
     * @param s
     *            the {@link Short} to convert.
     * @return the {@link BigInteger}.
     */
    public static BigInteger toBigInteger(final Short s) {
        if (s != null) {
            return BigInteger.valueOf(s);
        } else {
            return null;
        }
    }
}

Related

  1. hexToBigInteger(String hex)
  2. toBigInteger(byte[] bytes)
  3. toBigInteger(final byte[] array, final int offset, final int length)
  4. toBigInteger(final byte[] buffer, final int offset, final int length)
  5. toBigInteger(final byte[] bytes)
  6. toBigInteger(int arg)
  7. toBigInteger(int[] x, int bitsPerDigit)
  8. toBigInteger(List integerVector)
  9. toBigInteger(long value)