用Java将一个BigInteger乘到另一个BigInteger
BigInteger类用于超出原始数据类型限制的大整数计算。它提供了用于模块化算术,GCD计算,素数测试,素数生成,位操作和其他一些其他运算的操作。
要将一个BigInteger乘以另一个,请使用BigIntegermultiply()方法。
首先,让我们创建一些对象-
BigInteger one, two, three;
one = new BigInteger("2");
two = new BigInteger("8");将以上乘以并将其分配给第三个对象-
three = one.multiply(two);
以下是一个例子-
示例
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);
}
}输出结果
Multiplication: 2 * 8 = 16
热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便