2012-09-30 32 views

回答

2

BigInteger班是一個很好的開始大型整數的地方。

我必須檢查文檔以查看BigInteger的上限是什麼,但它應該滿足您的需求。

+0

不,實際上輸入數據約束<= 500位。只要我的程序在很長的範圍內,我的程序就能正常工作,但除此之外,我不知道該怎麼做。 –

+0

Gotcha。 :)對不起,當我談論大數字時,給出上限而不是下限似乎很奇怪。 – asteri

1
import java.math.BigInteger; 
public class BigIntegerExample 
{ 
    public static void main(String[] args) 
    { 
     BigInteger bigInteger1 = new BigInteger ("123456789"); 
     BigInteger bigInteger2 = new BigInteger ("112334"); 
     BigInteger bigIntResult = bigInteger1.multiply(bigInteger2); 
     System.out.println("Result is ==> " + bigIntResult); 
    } 
} 

您可以使用Biginteger類取整數值作爲整數。

+0

Abhishekkumar請多關照你的縮進。 –

+0

謝謝先生,我將來會記住這件事。 – Abhishekkumar