Description Of BigInteger: intValue()
The java.math.BigInteger.intValue() converts this BigInteger to a intBigInteger.intValue() method returns this BigInteger converted to a int
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 int values of bi1, bi2 to i1, i2
int i1 = bi1.intValue();
int i2 = bi2.intValue();
// print i1, i2 values
System.out.println(i1); // 123
System.out.println(i2); // -123
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น