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