- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Multiply one BigDecimal to another BigDecimal in Java
Use the multiply() method to multiply one BigDecimal to another in Java. This method returns a BigDecimal whose value is (this × multiplicand), and whose scale is (this.scale() + multiplicand.scale()).
The following is an example −
Example
import java.math.BigDecimal; public class Demo { public static void main(String[] argv) throws Exception { BigDecimal val1 = new BigDecimal("375789755.345778656"); BigDecimal val2 = new BigDecimal("525678755.155778656"); System.out.println("Value 1 = "+val1); System.out.println("Value 2 = "+val2); val2 = val2.multiply(val1); System.out.println("Result (Multiplication) = "+val2); } }
Output
Value 1 = 375789755.345778656 Value 2 = 525678755.155778656 Result (Multiplication) = 197544690790463541.417987494305166336
Let us see another example −
Example
import java.math.*; public class Demo { public static void main(String[] args) { BigDecimal bg1, bg2, bg3; bg1 = new BigDecimal("58.98"); bg2 = new BigDecimal("78.89"); bg3 = bg1.multiply(bg2); String str = "Multiplication = " +bg3; System.out.println( str ); } }
Output
Multiplication = 4652.9322
- Related Articles
- Subtract one BigDecimal from another BigDecimal in Java
- Java Program to divide one BigDecimal from another BigDecimal
- Truncate BigDecimal value in Java
- Negate a BigDecimal value in Java
- Math operations for BigDecimal in Java
- Working with BigDecimal values in Java
- Create a BigDecimal via string in Java
- Compare BigDecimal movePointRight and scaleByPowerOfTen in Java
- How to use BigDecimal in Ruby?
- Create BigDecimal Values via a long in Java
- Java Program to round a double passed to BigDecimal
- Java Program to create a BigDecimal from a string type value
- Multiply one BigInteger to another BigInteger in Java
- Multiply one polynomial to another in Python
- Multiply one Laguerre series to another in Python

Advertisements