- Java.math 包附加信息
- Java.math - 枚举
- Java.math - 讨论
Java.math.BigInteger.multiply() 方法
说明
java.math.BigInteger.multiply(BigInteger val) 返回值的 (this * val) 的 BigInteger。
声明
下面是 java.math.BigInteger.multiply() 方法的声明。
public BigInteger multiply(BigInteger val)
参数
val − 要乘以该 BigInteger 的值。
返回值
此方法返回值的为 this * val 的 BigInteger 对象。
异常
不适用
示例
以下示例演示了 math.BigInteger.multiply() 方法的用法。
package com.tutorialspoint;
import java.math.*;
public class BigIntegerDemo {
public static void main(String[] args) {
// create 3 BigInteger objects
BigInteger bi1, bi2, bi3;
bi1 = new BigInteger("7");
bi2 = new BigInteger("20");
// multiply bi1 with bi2 and assign result to bi3
bi3 = bi1.multiply(bi2);
String str = bi1 + " * " + bi2 + " = " +bi3;
// print bi3 value
System.out.println("Multiplication result is " +str);
}
}
让我们编译并运行以上程序,这将产生以下结果 −
Multiplication result is 7 * 20 = 140
java_math_biginteger.htm
广告