BigInteger类

可以让超过Integer范围内的数据进行运算

构造方法

public BigIntege(String val);

package com.jacky;

import java.math.BigInteger;

public class IntegerDemo {

	public static void main(String[] args) {
// TODO Auto-generated method stub Integer i = new Integer(100);
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE); BigInteger bi = new BigInteger("2147483648");
System.out.println("bi:" + bi);
}
}

/*
* public BigInteger add(BigInteger val);//加
* public BigInteger subtract(BigInteger val);//减
* public BigInteger multiply(BigInteger val);//乘
* public BigInteger divide(BigInteger val);//除
* public BigInteger[] divideAndRemainder(BigInteger val);//返回商和余数的数组
* */

import java.math.BigInteger;

/*
* public BigInteger add(BigInteger val);//加
* public BigInteger subtract(BigInteger val);//减
* public BigInteger multiply(BigInteger val);//乘
* public BigInteger divide(BigInteger val);//除
* public BigInteger[] divideAndRemainder(BigInteger val);//返回商和余数的数组
* */ public class IntegerDemo { public static void main(String[] args) {
// TODO Auto-generated method stub BigInteger bi1 = new BigInteger("100");
BigInteger bi2 = new BigInteger("50"); System.out.println("add:" + bi1.add(bi2));
System.out.println("subtract:" + bi1.subtract(bi2));
System.out.println("multiply:" + bi1.multiply(bi2));
System.out.println("divide:" + bi1.divide(bi2)); BigInteger bis[] = bi1.divideAndRemainder(bi2);
System.out.println("商:" + bis[0]);
System.out.println("余数、:" + bis[1]);
}
}

最新文章

  1. html input readonly 和 disable的区别
  2. Swift与Objective-C交互
  3. (数字IC)低功耗设计入门(一)
  4. 【京东详情页】——原生js爬坑之放大镜
  5. echarts 图表后面背景色
  6. DedeCMS找后台目录漏洞
  7. sql 多行转多列,多行转一列合并数据,列转行
  8. Daily Scrumming* 2015.12.12(Day 4)
  9. O'Reilly总裁提姆-奥莱理:什么是Web 2.0
  10. Linux 性能工具安装部署
  11. Python 自动补全(vim)
  12. Jira 6.0.5的详细安装及汉化授权
  13. C++与C#的多态
  14. Android规划周期任务
  15. Python:文件的读取、创建、追加、删除、清空
  16. 【离散数学】SDUT OJ 指定长度路径数
  17. 添加win10激活工具
  18. [转]NME Android目标中文输入问题完美解决!
  19. 1.centos7 安装zookeeper
  20. android hook 框架 libinject2 如何实现so注入

热门文章

  1. 我国三大常用坐标系:北京54、西安80和WGS-84
  2. 设计模式开闭原则--java
  3. SPSS Statistics 多个版本的下载安装激活步骤
  4. nsswitch.conf - 系统数据库及名字服务开关配置文件
  5. Django中间件拦截未登录url
  6. Codeforces 939 时区模拟 三分
  7. 1130. Infix Expression (25)
  8. sharepoint 2010 创建自定义的ASP.NET Web Service (上)
  9. linux运维、架构之路-Git+Jenkins实现自动化部署
  10. 前端node面试题之---对比JS和NodeJS的区别