BigInteger类概述

BigInteger类可以让超过Integer范围的数据进行运算,通常在对数字计算比较大的行业中应用的多一些。

package com.sutaoyu.usually_class;

import java.math.BigInteger;

public class String_test11 {
    public static void main(String[] args) {
        BigInteger s1 = new BigInteger("100");
        BigInteger s2 = new BigInteger("200");

        // +
        System.out.println(s1.add(s2)); //300
        // -
        System.out.println(s1.subtract(s2)); //-100
        //*
        System.out.println(s1.multiply(s2)); // 20000
        //÷
        System.out.println(s1.divide(s2)); // 0.5
        
    }
}

 

相关文章:

  • 2021-12-12
  • 2021-09-12
  • 2022-01-11
  • 2021-09-06
  • 2021-12-02
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-08
  • 2022-02-12
  • 2021-09-24
  • 2022-03-08
  • 2022-12-23
  • 2021-09-12
  • 2021-06-07
相关资源
相似解决方案