abs(): This method is available in the java.math.BigInteger class of Java.
Syntax:
BigInteger java.math.BigInteger.abs()
It returns a BigInteger whose value is the absolute value of this BigInteger.
Returns: abs(this)
For Example:
BigInteger bigInteger = new BigInteger("-1234")
bigInteger.abs() = > It returns 1234.
Approach
Java
import java.math.BigInteger;public class BigIntegerabs {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("-1234");System.out.println(bigInteger.abs());}}
Output:
1234
No comments:
Post a Comment