Java 大数类
划分结果存在数组。供应商下标0 在剩下的标记1
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner in = new Scanner(System.in); BigInteger a = in.nextBigInteger(); BigInteger b = in.nextBigInteger(); System.out.println("Add " + a.add(b)); System.out.println("Sub " + a.subtract(b)); System.out.println("Multi " + a.multiply(b)); System.out.println("Div " + a.divide(b)); System.out.println("Max " + a.max(b)); System.out.println("Min " + a.min(b)); BigInteger result[] = a.divideAndRemainder(b); System.out.println("Divide " + result[0] + " Remainder " + result[1]); } }
版权声明:本文博主原创文章。博客,未经同意不得转载。