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 BigInteger and() Method in Java The java.math.BigInteger.and(BigInteger val) method returns a BigInteger whose value is bitwise-AND of two BigIntegers. This method returns a negative number if both of the BigIntegers are negative. The and() method applies bitwise-AND operation upon the current bigInteger and bigInteger passed as p 2 min read BigInteger toByteArray() Method in Java The java.math.BigInteger.toByteArray() method returns an array of bytes containing the two's-complement representation of this BigInteger. The most significant byte of the byte array is present in the zeroth element. The returning array from this method contains sign bit and the minimum number of by 2 min read BigInteger andNot() Method in Java The java.math.BigInteger.andNot(BigInteger val) method returns a BigInteger whose value is (this & ~val) where this to the current BigInteger with which the function is being used and val is the bigInteger passed to the function as a parameter. This method, which is equivalent to and(val.not()), 2 min read BigInteger equals() Method in Java The java.math.BigInteger.equals(Object x) method compares this BigInteger with the object passed as the parameter and returns true in both are equal in value else it returns false. Syntax: public boolean equals(Object x) Parameter: This method accepts a single mandatory parameter x which is the Obje 3 min read BigInteger clearBit() Method in Java Prerequisite: BigInteger BasicsThe clearBit() method returns a BigInteger which is used to clear a particular bit position in a BigInteger. The bit at index n of binary representation of BigInteger will be cleared means converted to zero. Mathematically we can say that it is used to calculate this 2 min read Like