import java.math.*;public class Date {//3.封裝一類Java對象,計算兩個大整數(如123456789123456789123456789和987654321987654321987654321)//的和、差、積和商,並計算一個大整數的因子個數(因子中不包括1和大整數本身)。(選做)public static void main(String[] args) {BigInteger sum = new BigInteger("0"),difference = new BigInteger("0"),product = new BigInteger("0"), quotient = new BigInteger("0"), type1 = new BigInteger("123456789123456789123456789"), type2 = new BigInteger("987654321987654321987654321");sum = type1.add(type2);difference = type1.subtract(type2);product = type1.multiply(type2);quotient = type1.divide(type2);BigInteger i = new BigInteger("0");BigInteger one = new BigInteger("1");BigInteger two = new BigInteger("0");BigInteger yu = new BigInteger("0");int count =0;while(i.compareTo(type1)<=0){yu = i.remainder(type1);if(yu==two){count++;}i = i.add(one);}System.out.println("兩個大整數的和是:"+sum);System.out.println("兩個大整數的差是:"+difference);System.out.println("兩個大整數的積是:"+product);System.out.println("兩個大整數的商是:"+quotient);System.out.println("第一個大整數的因子個數為:"+count); }}