11.9 Biginteger 类(血干JAVA系类)

BigDecimal 类

  • 11.10 BigDecimal 类
      • 【例 11.35】验证 Biginteger

11.10 BigDecimal 类

11.9 Biginteger 类(血干JAVA系类)_第1张图片
11.9 Biginteger 类(血干JAVA系类)_第2张图片

【例 11.35】验证 Biginteger

package jiaqi;

import java.math.BigInteger;

public class demo346_1 {

	public static void main(String[] args) 
	{
		BigInteger bi1 = new BigInteger("100000000000000000");
		BigInteger bi2 = new BigInteger("500000000000000001");
		System.out.println(bi2.add(bi1));
		System.out.println(bi2.subtract(bi1));
		System.out.println(bi2.multiply(bi1));
		System.out.println(bi2.divide(bi1));
		System.out.println(bi2.max(bi1));
		System.out.println(bi2.min(bi1));
		BigInteger ans[] = bi2.divideAndRemainder(bi1);
		System.out.println("商="+ans[0]+"\t"+"余数"+ans[1]);
	}

}

你可能感兴趣的:(血干JAVA系列,java,开发语言)