多数のBigInteger整数:
インポートがjava.math.BigInteger; インポートjava.util.Scanner; パブリック クラスメイン{ 公共 静的 ボイドメイン(文字列[]引数){ スキャナスキャン = 新しいスキャナ(System.in)。 BigIntegerのAAは = 新しいのBigInteger( "100" ); BigIntegerのBB = 新しいのBigInteger( "25" ); BigIntegerのサブ = aa.subtract(BB)。// 大整数的减 のBigInteger(BB)= aa.addを追加します。 // 大整数的加 BigIntegerのMUL = aa.multiply(BB)。// 大きな整数乗算 のBigInteger DIV = aa.divide(BB); // 大きい整数加算 するSystem.out.println(sub.toString()); のSystem.out.println(add.toString()); システム。 out.printlnを(mul.toString()); のSystem.out.println(div.toString()); } }
多数とBigDecimalの浮動小数点演算使用のBigInteger