Java Data Type Tutorial - Java BigInteger.valueOf(long val)








Syntax

BigInteger.valueOf(long val) has the following syntax.

public static BigInteger valueOf(long val)

Example

In the following code shows how to use BigInteger.valueOf(long val) method.

/* w  w w. jav a  2 s .c o m*/
import java.math.BigInteger;

public class Main {

  public static void main(String[] args) {

    Long l = new Long(123456789L);

    BigInteger bi = BigInteger.valueOf(l);

    System.out.println(bi);
  }
}

The code above generates the following result.