Skip to content

Tag Archives: Java-math-package

The java.math.BigDecimal.toBigIntegerExact() is an inbuilt method in java that converts this BigDecimal to a BigInteger, checking for lost information. An exception is thrown if this… Read More
The java.math.BigDecimal.compareTo(BigDecimal bg) method checks for equality of this BigDecimal and BigDecimal object bg passed as parameter. The method considers two equal BigDecimal objects even… Read More
The java.math.BigDecimal.toBigInteger() is an inbuilt method in java that converts this BigDecimal to a BigInteger. This conversion is analogous to the narrowing primitive conversion from… Read More
The java.math.BigDecimal.stripTrailingZeros() is an inbuilt method in Java that returns a BigDecimal which is numerically equal to this one but with any trailing zeros removed… Read More
The java.math.BigDecimal.equals() method checks for equality of a BigDecimal value with the object passed. This method considers two BigDecimal objects equal if only if they… Read More
The java.math.BigDecimal.shortValueExact() is an inbuilt method in java that converts this BigDecimal to a short, checking for lost information. If this BigDecimal has a nonzero… Read More
The java.math.BigDecimal.signum() is an inbuilt method in Java that returns the signum function of this BigDecimal. The sign function or signum function is an odd… Read More
The java.math.BigInteger.bitLength() method returns the number of bits in the minimal two’s-complement representation of this BigInteger, excluding a sign bit. For positive BigIntegers, this is… Read More
java.math.BigDecimal.valueOf(long val) is an inbuilt method in Java that translates a long value into a BigDecimal value with a scale of zero. It allows us,… Read More
The java.math.BigDecimal.byteValueExact() is an in-built function which converts the BigDecimal to a byte and checks for lost information. Any BigDecimal value greater than 127 or… Read More
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… Read More
The java.math.BigInteger.shiftLeft(int n) method returns a BigInteger whose value is (this << n). The shift distance, n, may be negative, in which case this method… Read More
Prerequisite: BigInteger Basics The java.math.BigInteger.negate() method returns a BigInteger whose value is (- this). negate() method will change the singned bit of BigInteger. Syntax: public… Read More
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… Read More
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… Read More

Start Your Coding Journey Now!