Description Of BigInteger: valueOf(long val)
The java.math.BigInteger.valueOf(long val) returns a BigInteger whose value is equal to that of the specified long . This "static factory method" is provided in preference to a ( long ) constructor because it allows for reuse of frequently used BigIntegersBigInteger.valueOf(long val) method returns a BigInteger with the specified value
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = BigInteger.valueOf(54L);
BigInteger bi2 = BigInteger.valueOf(55);
Long ln = new Long(56);
BigInteger bi3 = BigInteger.valueOf(ln);
System.out.println(bi1);
System.out.println(bi2);
System.out.println(bi3);
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น