关于BigInteger的加减乘除使用
生活随笔
收集整理的這篇文章主要介紹了
关于BigInteger的加减乘除使用
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
public static void main(String[] args) {BigInteger bg1 = new BigInteger("12345678912");// int類型轉(zhuǎn)BigIntegerint value = 12345678912;BigInteger bg2 = BigInteger.valueOf(value);//1.加法System.out.println(bg1.add(bg2));//2.減法System.out.println(bg1.subtract(bg2));//3.乘法System.out.println(bg1.multiply(bg2));//4.除法System.out.println(bg2.divide(bg1));System.out.println("--------------");//5.取除數(shù)和余數(shù)的數(shù)組BigInteger[] bg_arry = bg2.divideAndRemainder(bg1);for(int i=0; i< bg_arry.length; i++) {System.out.println(bg_arry[i]);}}
總結
以上是生活随笔為你收集整理的关于BigInteger的加减乘除使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android打开系统前置摄像头驱动,a
- 下一篇: 插入数据的时候出现错误:Error du