1. 程式人生 > 其它 >Guava系列:BigIntegerMath/LongMath/IntMath使用方法

Guava系列:BigIntegerMath/LongMath/IntMath使用方法

技術標籤:Guava

場景

BigIntegerMath/LongMath/IntMath

demo

package com.nio4444.demo;

import com.google.common.math.BigIntegerMath;
import com.google.common.math.IntMath;
import com.google.common.math.LongMath;

import java.math.BigInteger;
import java.math.RoundingMode;

public class IntMathDemo {
    public static void main(String[] args) {
        System.out.println(BigIntegerMath.divide(BigInteger.TEN, new BigInteger("2"), RoundingMode.UNNECESSARY));
        System.out.println( LongMath.divide(343,22, RoundingMode.FLOOR)) ;
        IntMath.checkedAdd(2000000000,999999999) ;
    }
}