BigInteger negate() Method in Java Last Updated : 06 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 the operation of (- this). Examples: Input: value = 2300 Output: -2300 Explanation: Binary signed 2's complement of 2300 = 0000100011111100 Signed bit are 0000 change sign bit to 1111 so negate of 0000100011111100 in signed 2's complement is 1111011100000100 Decimal value = -2300. Input: value = 567689 Output: -567689 Below program illustrates negate() method of BigInteger. Java /* *Program Demonstrate negate() method of BigInteger */ import java.math.*; public class GFG { public static void main(String[] args) { // Create BigInteger object BigInteger biginteger = new BigInteger("2300"); // Call negate() method to find -this BigInteger finalvalue = biginteger.negate(); String result = "Result of negate operation on " + biginteger + " is " + finalvalue; // Prints result System.out.println(result); } } Output:Result of negate operation on 2300 is -2300 Reference: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#negate() Comment More infoAdvertise with us Next Article BigInteger negate() 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 not() Method in Java 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: 1 min read 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 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 abs() Method in Java prerequisite : BigInteger Basics The java.math.BigInteger.abs() method returns absolute value of a BigInteger. By using this method one can find absolute value of any large size of numerical data stored as BigInteger. Syntax: public BigInteger abs() Parameters: The method does not take any parameter 1 min read Like