Description Of BigInteger: longValue()
The java.math.BigInteger.longValue() converts this BigInteger to a longBigInteger.longValue() method returns this BigInteger converted to a long
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
// assign values to bi1, bi2
BigInteger bi1 = new BigInteger("123");
BigInteger bi2 = new BigInteger("-123");
// assign long values of bi1, bi2 to i1, i2
long i1 = bi1.longValue();
long i2 = bi2.longValue();
// print i1, i2 values
System.out.println(i1); // 123
System.out.println(i2); // -123
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น