Description Of BigInteger: abs()
The
java.math.BigInteger.abs() returns a BigInteger whose value is the absolute value of this BigInteger
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("456");
BigInteger bi2 = new BigInteger("-456");
System.out.println("Absolute value of " + bi1 + " is " + bi1.abs()); // Absolute value of 456 is 456
System.out.println("Absolute value of " + bi2 + " is " + bi2.abs()); // Absolute value of -456 is 456
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น