

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 BigInteger to another BigInteger in Java
BigInteger class is used for big integer calculations which are outside the limit of the primitive data types. It provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations.
To multiply one BigInteger to another, use the BigInteger multiply() method.
First, let us create some objects −
BigInteger one, two, three; one = new BigInteger("2"); two = new BigInteger("8");
Multiply the above and assign it to the third object −
three = one.multiply(two);
The following is an example −
Example
import java.math.*; public class BigIntegerDemo { public static void main(String[] args) { BigInteger one, two, three; one = new BigInteger("2"); two = new BigInteger("8"); three = one.multiply(two); String res = one + " * " + two + " = " +three; System.out.println("Multiplication: " +res); } }
Output
Multiplication: 2 * 8 = 16
- Related Questions & Answers
- Subtract one BigInteger from another BigInteger in Java
- Divide one BigInteger from another BigInteger in Java
- Convert BigInteger into another radix number in Java
- BigInteger class in Java
- Negate a BigInteger in Java
- Create BigInteger via string in Java
- Working with BigInteger Values in Java
- Math Operations on BigInteger in Java
- BigInteger Class in C#
- Multiply one BigDecimal to another BigDecimal in Java
- Shift right in a BigInteger in Java
- Shift left in a BigInteger in Java
- Parse Octal string to create BigInteger in Java
- Parse decimal string to create BigInteger in Java
- Parse hexadecimal string to create BigInteger in Java
Advertisements