BigInteger not() Method in Java Last Updated : 04 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The java.math.BigInteger.not() method is used to find the bitwise-NOT of a BigInteger. This method returns a negative value if and only if this BigInteger is non-negative. The BigInteger.not() method apply bitwise Not operation upon the current bigInteger. Syntax: public BigInteger not() Parameters: The method does not take any parameters. Return Value: The method returns the bitwise-NOT value of a BigInteger with which it is used. Examples: 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 Below program illustrate the not() method of BigInteger(): Java /* *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); } } Output: Result of NOT operation on 2300 is -2301 Reference:https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#and(java.math.BigInteger) Comment More infoAdvertise with us Next Article BigInteger not() Method in Java A AmanSingh2210 Follow Improve Article Tags : Java Java-lang package Java-Functions java-math Java-BigInteger Java-math-package +2 More Practice Tags : JavaJava-BigInteger Similar Reads BigInteger or() method in Java Prerequisite: BigInteger Basics The java.math.BigInteger.or(BigInteger val) method is used to perform bitwise OR of two BigIntegers. One of the BigInteger is passed in parameter and the other on which the function is called. This method returns a negative number if either of the BigIntegers used wit 2 min read BigInteger xor() Method in Java Prerequisite: BigInteger Basics The xor(BigInteger val) method returns bitwise-XOR of two bigIntegers. This method returns a negative BigInteger if and only if exactly one of the current bigInteger and the bigInteger passed in parameter id negative. The xor() method of BigInteger class apply bitwise 2 min read BigInteger negate() Method in Java Prerequisite: BigInteger Basics The java.math.BigInteger.negate() method returns a BigInteger whose value is (- this). negate() method will change the signed bit of BigInteger. Syntax: public BigInteger negate() Parameters: The method does not accept any parameter. Return Value: The method returns t 1 min read BigInteger signum() Method in Java prerequisite : BigInteger Basics The java.math.BigInteger.signum() method helps us to identify whether a BigInteger is positive or zero or negative. It returns one of the following values depending on the following conditions: returns -1 when number is negativereturns 0 when number is zeroreturns +1 2 min read BigInteger testBit() Method in Java prerequisite : BigInteger Basics The java.math.BigInteger.testBit(index) method returns true if and only if the designated bit is set. This method Computes (this & (1<<n)) != 0). Syntax: public boolean testBit(int n) Parameter: The method takes one parameter n of integer type which refers 2 min read Like