- 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
Calculate the power on a BigInteger in Java
Use the BigInteger pow() method in Java to calculate the power on a BigInteger.
First, let us create some objects.
BigInteger one, two; one = new BigInteger("5");
Perform the power operation and assign it to the second object −
// power operation two = one.pow(3);
The following is an example −
Example
import java.math.*; public class BigIntegerDemo { public static void main(String[] args) { BigInteger one, two; one = new BigInteger("5"); System.out.println("Actual Value: " +one); // power operation two = one.pow(3); System.out.println("Result: " +two); } }
Output
Actual Value: 5 Negated Value: 125
- Related Articles
- Math Operations on BigInteger in Java
- Calculate the Power of a Number in Java Program
- Java program to calculate the power of a number
- Negate a BigInteger in Java
- Multiply one BigInteger to another BigInteger in Java
- Subtract one BigInteger from another BigInteger in Java
- Divide one BigInteger from another BigInteger in Java
- Java Program to calculate the power using recursion
- Java Program to perform XOR operation on BigInteger
- Java Program to perform AND operation on BigInteger
- Java Program to implement NOT operation on BigInteger
- Java Program to implement OR operation on BigInteger
- Java Program to implement andNot operation on BigInteger
- Shift right in a BigInteger in Java
- Shift left in a BigInteger in Java

Advertisements