Java Math BigInteger.valueOf() 方法


Java Math BigInteger.valueOf() 方法

package com.codingdict;



import java.math.*;



public class BigIntegerDemo {



   public static void main(String[] args) {



      // create a BigInteger object

      BigInteger bi;



      // create and assign value to Long object

      Long l = new Long(123456789L);



      // assign the biginteger value of l to bi

      // static method is called using class name

      bi = BigInteger.valueOf(l);



      String str = "BigIntger value of Long " + l + " is " +bi;



      // print bi value

      System.out.println( str );

   }

}