Java BigDecimal multiply() method20 Mar 2025 | 2 min read The multiply() method of java BigDecimal class is used to obtain a BigDecimal whose value is (this multiplicand), and whose scale is (this.scale() + multiplicand.scale()) with rounding according to the context settings. Syntax:Parameter:multiplicand: value to be multiplied by this BigDecimal. mc: the context to use. Exception:ArithmeticException- if the result is inexact but the rounding mode is UNNECESSARY, then it throws exception : Returns:It returns this*multiplicand, rounded as necessary. Example 1Output: Multiplication of 34.203 and 44.25 is =1513.48275 Example 2Output: Multiplication of -67 and 25 is = -1675 Example 3Output: Multiplication of -120 and -35 is = 4200 Next TopicJava BigDecimal |
Java BigDecimal method The method of java BigDecimal class is used to obtain a maximum value between BigDecimal and val. Syntax: public BigDecimal max(BigDecimal val) Parameter: Val: value with which the maximum is to be computed. Exception: No Returns: It returns maximum value between two BigDecimal values. In case if both are...
4 min read
Java BigDecimal Method The method of Java BigDecimal class is used to Compare this BigDecimal with the specified Object for equality. In this method, two BigDecimal objects are found to be equal if they are equal in value and scale. Note: 2.0 is not equal...
3 min read
The BigDecimal class provides operation for arithmetic, comparison, hashing, rounding, manipulation and format conversion. This method can handle very small and very big floating point numbers with great precision. In java, BigDecimal consists of a random precision integer scale and a 32-bit integer scale. If positive...
5 min read
Java BigDecimal method The method of Java BigDecimal class is used to convert the BigDecimal value into a double type. If BigDecimal has very big value represented as a double, it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate. While conversion, we can...
2 min read
Java math.BigDecimal. method The java.math.BigDecimal. method is used to divide the BigDecimal object just like division in Mathmatics. Syntax BigDecimal obj1ofBigDecimal=obj1ofBigDecimal.divide(obj2ofBigDecimal); Ex:-BigDecimal big1=new BigDecimal("25"); BigDecimal big2=new BigDecimal("5"); big1=big1.divide(big2); Example import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class BigDecimaldivideExample{ public static void main(String [] ag) { int n1,n2; System.out.println("Enter...
1 min read
Java math.BigDecimal. method The java.math.BigDecimal.add() method is used to find out the absolute value of any number. method does not take any parameter. Syntax BigDecimal objofBigDecimal=objofBigDecimal.; Ex:-BigDecimal big1=new BigDecimal(); big1=big1.; Example 1 import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class BigDecimalabsExample1{ public static void main(String [] ag) { BigDecimal big1=new BigDecimal("-40"); big1=big1.; System.out.println("Abs...
1 min read
Java BigDecimal Method The method of java BigDecimal class is used to Convert a BigDecimal to an int type as well as this method also check for the lost information. Syntax: public int Parameter: No Exception: If this has a non-zero fractional part, or will not fit in an...
4 min read
java math.BigDecimal. method The java.math.BigDecimal.divide() method is used to add the BigDecimal object . Syntax BigDecimal obj1ofBigDecimal=obj1ofBigDecimal.divide(obj2ofBigDecimal); Ex:-BigDecimal big1=new BigDecimal("5"); BigDecimal big2=new BigDecimal("5"); big1=big1.add(big2); Example 1 import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class BigDecimaladdExample1{ public static void main(String [] ag) { int n1,n2; System.out.println("Enter first and second...
1 min read
Java BigDecimal method The method of java BigDecimal class is used to move the decimal point of the current BigDecimal by n places to the right. Note: If n is non-negative, the call merely subtracts n from the scale. If n is negative, the call is equivalent...
3 min read
Java BigDecimal method The method of java BigDecimal class is used to obtain a BigDecimal whose value is the negated value (-this) of the BigDecimal with which it is used. Syntax: public BigDecimal public BigDecimal negate(MathContext mc) Parameter: mc: the context to use. Exception: ArithmeticException- if the result is inexact...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India