BigInteger abs() Method in Java Last Updated : 20 May, 2019 Comments Improve Suggest changes Like Article Like Report 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 parameters. Return Value: The method returns the absolute value of a BigInteger. Examples: Input: -2300 Output: 2300 Explanation: Applying mathematical abs() operation on -2300, positive 2300 is obtained i.e |-2300| = 2300. Input: -5482549 Output: 5482549 Below program illustrates abs() method of BigInteger: Java // Below program illustrates the abs() method // of BigInteger import java.math.*; public class GFG { public static void main(String[] args) { // Create BigInteger object BigInteger biginteger=new BigInteger("-2300"); // abs() method on bigInteger to find the absolute value // of a BigInteger BigInteger absolutevalue= biginteger.abs(); // Define result String result ="BigInteger "+biginteger+ " and Absolute value is "+absolutevalue; // Print result System.out.println(result); } } Output: BigInteger -2300 and Absolute value is 2300 Reference: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#abs() Comment More infoAdvertise with us Next Article BigInteger abs() Method in Java A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java-math Java-BigInteger Java-math-package +1 More Practice Tags : JavaJava-BigInteger Similar Reads 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 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 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 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 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 mod() Method in Java The java.math.BigInteger.mod(BigInteger big) method returns a BigInteger whose value is equal to (this BigInteger modfunction big(BigInteger passed as parameter)).In other words we can say that this method returns the value after performing (this % big) step.The mod operation finds the remainder aft 3 min read BigInteger sqrt() Method in Java java.math.BigInteger.sqrt() is an inbuilt function added in Java SE 9 & JDK 9 which returns BigInteger value of square root of a BigInteger on which sqrt() method is applied. It is the same as the floor(sqrt(n)) where n is a number. This Square root is less than the real square root if the real 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 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 setBit() Method in Java The java.math.BigInteger.setbit(index) method returns a Big-integer whose value is equivalent to this Big-integer with the designated bit set. The method computes (this | (1<<n)). The bit at index n of binary representation of Big-integer will be set means converted to 1. Syntax: public BigInt 2 min read Like