这个 JAVA数学大整数。不是() 方法用于查找BigInteger的按位NOT。当且仅当BigInteger为非负时,此方法返回负值。大整数。not()方法对当前bigInteger应用按位not操作。
null
语法:
public BigInteger not()
参数: 该方法不采用任何参数。
返回值: 该方法返回与其一起使用的BigInteger的按位NOT值。
例如:
Input: value = 2300 Output: -2301 Explanation: Binary of 2300 = 100011111100 NOT of 100011111100 in signed 2's complement is 1111011100000011 Decimal value = -2301. Input: value = 567689 Output: -567690
下面的程序演示了BigInteger()的not()方法:
/* *Program Demonstrate not() method of BigInteger */ import java.math.*; public class GFG { public static void main(String[] args) { // Creates BigInteger object BigInteger biginteger = new BigInteger( "2300" ); // Call not() method to find ~this BigInteger finalvalue = biginteger.not(); String result = "Result of NOT operation on " + biginteger + " is " + finalvalue; // Print result System.out.println(result); } } |
输出:
Result of NOT operation on 2300 is -2301
参考: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#and(java.math.biginger)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END