• BigInteger类的方法


    BigInteger类的方法
     *    divide(BigInteger val)
                返回其值为 (this / val) 的 BigInteger。
              multiply(BigInteger val)
                返回其值为 (this * val) 的 BigInteger。
              subtract(BigInteger val)
                返回其值为 (this - val) 的 BigInteger。
              add(BigInteger val)
                返回其值为 (this + val) 的 BigInteger
             remainder(BigInteger val)
                返回其值为 (this % val) 的 BigInteger。
            divideAndRemainder(BigInteger val)
                返回包含 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。 返回值BigInteger[]

     1 package integer;
     2 
     3 import java.math.BigInteger;
     4 
     5 /**
     6  * BigInteger类的方法
     7  *         divide(BigInteger val) 
     8           返回其值为 (this / val) 的 BigInteger。
     9           multiply(BigInteger val) 
    10           返回其值为 (this * val) 的 BigInteger。
    11           subtract(BigInteger val) 
    12           返回其值为 (this - val) 的 BigInteger。
    13           add(BigInteger val) 
    14           返回其值为 (this + val) 的 BigInteger
    15          remainder(BigInteger val) 
    16           返回其值为 (this % val) 的 BigInteger。
    17      divideAndRemainder(BigInteger val) 
    18           返回包含 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。 返回值BigInteger[]
    19  * @author star
    20  *
    21  */
    22 public class BigIntegerDemo {
    23     public static void main(String[] args) {
    24         String s = Integer.MAX_VALUE+"";//2147483647
    25         System.out.println(s);
    26         
    27         String s1 = Long.MAX_VALUE+"";//9223372036854775807
    28         System.out.println(s1);
    29         
    30         BigInteger big = new BigInteger("5344444444444444778815991");
    31         BigInteger big2 = new BigInteger("5344444444599");
    32         //运算
    33         System.out.println(big.add(big2));
    34         System.out.println(big.subtract(big2));
    35         System.out.println(big.multiply(big2));
    36          System.out.println(big.divide(big2));
    37          
    38          //返回一个BigInteger[]数组
    39          BigInteger b1 = new BigInteger("10");
    40         BigInteger b2 = new BigInteger("2");
    41         BigInteger[] res = b1.divideAndRemainder(b2);
    42         System.out.println(res[0]);
    43         System.out.println(res[1]);
    44         
    45     }
    46 }
    BigInteger
  • 相关阅读:
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    Centos7 防火墙相关命令
    Geospark-属性字段处理
    Spark高级数据分析——纽约出租车轨迹的空间和时间数据分析
    GeoMesa,整体架构,创建Schema并导入数据
    GeoJson的生成与解析,JSON解析,Java读写geojson,geotools读取shp文件,Geotools中Geometry对象与GeoJson的相互转换
    JTS
  • 原文地址:https://www.cnblogs.com/star521/p/8886305.html
Copyright © 2020-2023  润新知