JAVA中大数经常使用的函数
声明为 BigInteger 的 java.math 中的字段
static BigInteger BigInteger. ONE
BigInteger 的常量 1。
static BigInteger BigInteger. TEN
BigInteger 的常量 10。
static BigInteger BigInteger. ZERO
BigInteger 的常量 0。 返回 BigInteger 的 java.math 中的方法
BigInteger BigInteger. abs ()
返回其值是此 BigInteger 的绝对值的 BigInteger。
BigInteger BigInteger. add (BigInteger val)
返回其值为 (this + val) 的 BigInteger。
BigInteger BigInteger. and (BigInteger val)
返回其值为 (this & val) 的 BigInteger。
BigInteger BigInteger. andNot (BigInteger val)
返回其值为 (this & ~val) 的 BigInteger。 BigInteger BigInteger. clearBit (int n)
返回其值与清除了指定位的此 BigInteger 等效的 BigInteger。 BigInteger BigInteger. divide (BigInteger val)
返回其值为 (this / val) 的 BigInteger。 BigInteger [] BigInteger. divideAndRemainder (BigInteger val)
返回包括 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。
BigInteger BigInteger. flipBit (int n)
返回其值与对此 BigInteger 进行指定位翻转后的值等效的 BigInteger。 BigInteger BigInteger. gcd (BigInteger val)
返回一个 BigInteger。其值是 abs(this) 和 abs(val) 的最大公约数。
BigInteger BigInteger. max (BigInteger val)
返回此 BigInteger 和 val 的最大值。
BigInteger BigInteger. min (BigInteger val)
返回此 BigInteger 和 val 的最小值。
BigInteger BigInteger. mod (BigInteger m)
返回其值为 (this mod m ) 的 BigInteger。
BigInteger BigInteger. modInverse (BigInteger m)
返回其值为 (this-1 mod m) 的 BigInteger。
BigInteger BigInteger. modPow (BigInteger exponent, BigInteger m)
返回其值为 (thisexponent mod m) 的 BigInteger。 BigInteger BigInteger. multiply (BigInteger val)
返回其值为 (this * val) 的 BigInteger。
BigInteger BigInteger. negate ()
返回其值是 (-this) 的 BigInteger。 BigInteger BigInteger. nextProbablePrime ()
返回大于此 BigInteger 的可能为素数的第一个整数。
BigInteger BigInteger. not ()
返回其值为 (~this) 的 BigInteger。 BigInteger BigInteger. or (BigInteger val)
返回其值为 (this | val) 的 BigInteger。
BigInteger BigInteger. pow (int exponent)
返回其值为 (thisexponent ) 的 BigInteger。
static BigInteger BigInteger. probablePrime (int bitLength, Random rnd)
返回有可能是素数的、具有指定长度的正 BigInteger。
BigInteger BigInteger. remainder (BigInteger val)
返回其值为 (this % val) 的 BigInteger。
BigInteger BigInteger. setBit (int n)
返回其值与设置了指定位的此 BigInteger 等效的 BigInteger。 BigInteger BigInteger. shiftLeft (int n)
返回其值为 (this << n) 的 BigInteger。
BigInteger BigInteger. shiftRight (int n)
返回其值为 (this >> n) 的 BigInteger。
BigInteger BigInteger. subtract (BigInteger val)
返回其值为 (this - val) 的 BigInteger。
BigInteger BigDecimal. toBigInteger ()
将此 BigDecimal 转换为 BigInteger 。
BigInteger BigDecimal. toBigIntegerExact ()
将此 BigDecimal 转换为 BigInteger ,以检查丢失的信息。
BigInteger BigDecimal. unscaledValue ()
返回其值为此 BigDecimal 的非标度值 的 BigInteger 。
static BigInteger BigInteger. valueOf (long val)
返回其值等于指定 long 的值的 BigInteger。
BigInteger BigInteger. xor (BigInteger val)
返回其值为 (this ^ val) 的 BigInteger。
參数类型为 BigInteger 的 java.math 中的方法
BigInteger BigInteger. add (BigInteger val)
返回其值为 (this + val) 的 BigInteger。
BigInteger BigInteger. and (BigInteger val)
返回其值为 (this & val) 的 BigInteger。
BigInteger BigInteger. andNot (BigInteger val)
返回其值为 (this & ~val) 的 BigInteger。
int BigInteger. compareTo (BigInteger val)
将此 BigInteger 与指定的 BigInteger 进行比較。
BigInteger BigInteger. divide (BigInteger val)
返回其值为 (this / val) 的 BigInteger。 BigInteger [] BigInteger. divideAndRemainder (BigInteger val)
返回包括 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。
BigInteger BigInteger. gcd (BigInteger val)
返回一个 BigInteger。其值是 abs(this) 和 abs(val) 的最大公约数。 BigInteger BigInteger. max (BigInteger val)
返回此 BigInteger 和 val 的最大值。
BigInteger BigInteger. min (BigInteger val)
返回此 BigInteger 和 val 的最小值。
BigInteger BigInteger. mod (BigInteger m)
返回其值为 (this mod m ) 的 BigInteger。 BigInteger BigInteger. modInverse (BigInteger m)
返回其值为 (this-1 mod m) 的 BigInteger。
BigInteger BigInteger. modPow (BigInteger exponent, BigInteger m)
返回其值为 (thisexponent mod m) 的 BigInteger。
BigInteger BigInteger. multiply (BigInteger val)
返回其值为 (this * val) 的 BigInteger。 BigInteger BigInteger. or (BigInteger val)
返回其值为 (this | val) 的 BigInteger。
BigInteger BigInteger. remainder (BigInteger val)
返回其值为 (this % val) 的 BigInteger。
BigInteger BigInteger. subtract (BigInteger val)
返回其值为 (this - val) 的 BigInteger。
BigInteger BigInteger. xor (BigInteger val)
返回其值为 (this ^ val) 的 BigInteger。 參数类型为 BigInteger 的 java.math 中的构造方法
BigDecimal (BigInteger val)
将 BigInteger 转换为 BigDecimal 。
BigDecimal (BigInteger unscaledVal, int scale)
将 BigInteger 非标度值和 int 标度转换为 BigDecimal 。 BigDecimal (BigInteger unscaledVal, int scale, MathContext mc)
将 BigInteger 非标度值和 int 标度转换为 BigDecimal (依据上下文设置进行舍入)。
BigDecimal (BigInteger val, MathContext mc)
将 BigInteger 转换为 BigDecimal (依据上下文设置进行舍入)。 java.util 中 BigInteger 的使用 返回 BigInteger 的 java.util 中的方法
BigInteger Scanner. nextBigInteger ()
将输入信息的下一个标记扫描为一个 BigInteger 。 BigInteger Scanner. nextBigInteger (int radix)
将输入信息的下一个标记扫描为一个 BigInteger 。 java.math 中 BigDecimal 的使用
声明为 BigDecimal 的 java.math 中的字段
static BigDecimal BigDecimal. ONE
值为 1,标度为 0。 static BigDecimal BigDecimal. TEN
值为 10,标度为 0。
static BigDecimal BigDecimal. ZERO
值为 0,标度为 0。 返回 BigDecimal 的 java.math 中的方法
BigDecimal BigDecimal. abs ()
返回 BigDecimal ,其值为此 BigDecimal 的绝对值,其标度为 this.scale() 。 BigDecimal BigDecimal. abs (MathContext mc)
返回其值为此 BigDecimal 绝对值的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. add (BigDecimal augend)
返回一个 BigDecimal ,其值为 (this + augend) ,其标度为 max(this.scale(), augend.scale()) 。 BigDecimal BigDecimal. add (BigDecimal augend, MathContext mc)
返回其值为 (this + augend) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. divide (BigDecimal divisor)
返回一个 BigDecimal ,其值为 (this / divisor) ,其首选标度为 (this.scale() - divisor.scale()) ;假设无法表示准确的商值(由于它有无穷的十进制扩展),则抛出 ArithmeticException 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为 this.scale() 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, int roundingMode)
返回一个 BigDecimal 。其值为 (this / divisor) ,其标度为指定标度。 BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, RoundingMode roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为指定标度。
BigDecimal BigDecimal. divide (BigDecimal divisor, MathContext mc)
返回其值为 (this / divisor) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. divide (BigDecimal divisor, RoundingMode roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) 。其标度为 this.scale() 。
BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟对两个操作数计算所得到的 remainder 。 BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor, MathContext mc)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟依据上下文设置对两个操作数进行舍入计算所得到的 remainder 的结果。 BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor)
返回 BigDecimal 。其值为向下舍入所得商值 (this / divisor) 的整数部分。
BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor, MathContext mc)
返回 BigDecimal 。其值为 (this / divisor) 的整数部分。 BigDecimal BigDecimal. max (BigDecimal val)
返回此 BigDecimal 和 val 的最大值。
BigDecimal BigDecimal. min (BigDecimal val)
返回此 BigDecimal 和 val 的最小值。 BigDecimal BigDecimal. movePointLeft (int n)
返回一个 BigDecimal ,它等效于将该值的小数点向左移动 n 位。
BigDecimal BigDecimal. movePointRight (int n)
返回一个 BigDecimal 。它等效于将该值的小数点向右移动 n 位。 BigDecimal BigDecimal. multiply (BigDecimal multiplicand)
返回一个 BigDecimal ,其值为 (this × multiplicand) ,其标度为 (this.scale() + multiplicand.scale()) 。
BigDecimal BigDecimal. multiply (BigDecimal multiplicand, MathContext mc)
返回其值为 (this × multiplicand) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. negate ()
返回 BigDecimal 。其值为 (-this) ,其标度为 this.scale() 。
BigDecimal BigDecimal. negate (MathContext mc)
返回其值为 (-this) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. plus ()
返回 BigDecimal ,其值为 (+this) ,其标度为 this.scale() 。
BigDecimal BigDecimal. plus (MathContext mc)
返回其值为 (+this) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. pow (int n)
返回其值为 (thisn ) 的 BigDecimal 。准确计算该幂,使其具有无限精度。 BigDecimal BigDecimal. pow (int n, MathContext mc)
返回其值为 (thisn ) 的 BigDecimal 。 BigDecimal BigDecimal. remainder (BigDecimal divisor)
返回其值为 (this % divisor) 的 BigDecimal 。
BigDecimal BigDecimal. remainder (BigDecimal divisor, MathContext mc)
返回其值为 (this % divisor) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. round (MathContext mc)
返回依据 MathContext 设置进行舍入后的 BigDecimal 。
BigDecimal BigDecimal. scaleByPowerOfTen (int n)
返回其数值等于 (this * 10n ) 的 BigDecimal。
BigDecimal BigDecimal. setScale (int newScale)
返回一个 BigDecimal ,其标度为指定值。其值在数值上等于此 BigDecimal 的值。
BigDecimal BigDecimal. setScale (int newScale, int roundingMode)
返回一个 BigDecimal ,其标度为指定值,其非标度值通过此 BigDecimal 的非标度值乘以或除以十的适当次幂来确定。以维护其总值。
BigDecimal BigDecimal. setScale (int newScale, RoundingMode roundingMode)
返回 BigDecimal ,其标度为指定值,其非标度值通过此 BigDecimal 的非标度值乘以或除以十的适当次幂来确定。以维护其总值。
BigDecimal BigDecimal. stripTrailingZeros ()
返回数值上等于此小数。但从该表示形式移除全部尾部零的 BigDecimal 。
BigDecimal BigDecimal. subtract (BigDecimal subtrahend)
返回一个 BigDecimal ,其值为 (this - subtrahend) 。其标度为 max(this.scale(), subtrahend.scale()) 。
BigDecimal BigDecimal. subtract (BigDecimal subtrahend, MathContext mc)
返回其值为 (this - subtrahend) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. ulp ()
返回此 BigDecimal 的 ulp(最后一位的单位)的大小。 static BigDecimal BigDecimal. valueOf (double val)
使用 Double.toString(double) 方法提供的 double 规范的字符串表示形式将 double 转换为 BigDecimal 。 static BigDecimal BigDecimal. valueOf (long val)
将 long 值转换为具有零标度的 BigDecimal 。
static BigDecimal BigDecimal. valueOf (long unscaledVal, int scale)
将 long 非标度值和 int 标度转换为 BigDecimal 。
參数类型为 BigDecimal 的 java.math 中的方法
BigDecimal BigDecimal. add (BigDecimal augend)
返回一个 BigDecimal ,其值为 (this + augend) ,其标度为 max(this.scale(), augend.scale()) 。
BigDecimal BigDecimal. add (BigDecimal augend, MathContext mc)
返回其值为 (this + augend) 的 BigDecimal (依据上下文设置进行舍入)。 int BigDecimal. compareTo (BigDecimal val)
将此 BigDecimal 与指定的 BigDecimal 比較。 BigDecimal BigDecimal. divide (BigDecimal divisor)
返回一个 BigDecimal ,其值为 (this / divisor) 。其首选标度为 (this.scale() - divisor.scale()) ;假设无法表示准确的商值(由于它有无穷的十进制扩展)。则抛出 ArithmeticException 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为 this.scale() 。
BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, int roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为指定标度。 BigDecimal BigDecimal. divide (BigDecimal divisor, int scale, RoundingMode roundingMode)
返回一个 BigDecimal 。其值为 (this / divisor) 。其标度为指定标度。
BigDecimal BigDecimal. divide (BigDecimal divisor, MathContext mc)
返回其值为 (this / divisor) 的 BigDecimal (依据上下文设置进行舍入)。
BigDecimal BigDecimal. divide (BigDecimal divisor, RoundingMode roundingMode)
返回一个 BigDecimal ,其值为 (this / divisor) ,其标度为 this.scale() 。 BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟对两个操作数计算所得到的 remainder 。
BigDecimal [] BigDecimal. divideAndRemainder (BigDecimal divisor, MathContext mc)
返回由两个元素组成的 BigDecimal 数组,该数组包括 divideToIntegralValue 的结果,后跟依据上下文设置对两个操作数进行舍入计算所得到的 remainder 的结果。 BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor)
返回 BigDecimal ,其值为向下舍入所得商值 (this / divisor) 的整数部分。
BigDecimal BigDecimal. divideToIntegralValue (BigDecimal divisor, MathContext mc)
返回 BigDecimal ,其值为 (this / divisor) 的整数部分。 BigDecimal BigDecimal. max (BigDecimal val)
返回此 BigDecimal 和 val 的最大值。
BigDecimal BigDecimal. min (BigDecimal val)
返回此 BigDecimal 和 val 的最小值。 BigDecimal BigDecimal. multiply (BigDecimal multiplicand)
返回一个 BigDecimal 。其值为 (this × multiplicand) 。其标度为 (this.scale() + multiplicand.scale()) 。
BigDecimal BigDecimal. multiply (BigDecimal multiplicand, MathContext mc)
返回其值为 (this × multiplicand) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. remainder (BigDecimal divisor)
返回其值为 (this % divisor) 的 BigDecimal 。
BigDecimal BigDecimal. remainder (BigDecimal divisor, MathContext mc)
返回其值为 (this % divisor) 的 BigDecimal (依据上下文设置进行舍入)。 BigDecimal BigDecimal. subtract (BigDecimal subtrahend)
返回一个 BigDecimal ,其值为 (this - subtrahend) ,其标度为 max(this.scale(), subtrahend.scale()) 。
BigDecimal BigDecimal. subtract (BigDecimal subtrahend, MathContext mc)
返回其值为 (this - subtrahend) 的 BigDecimal (依据上下文设置进行舍入)。 java.util 中 BigDecimal 的使用 返回 BigDecimal 的 java.util 中的方法
BigDecimal Scanner. nextBigDecimal ()
将输入信息的下一个标记扫描为一个 BigDecimal 。
JAVA中大数经常使用的函数的更多相关文章
- Java中的Random()函数-----转载
Java中的Random()函数 (2013-01-24 21:01:04) 转载▼ 标签: java random 随机函数 杂谈 分类: Java 今天在做Java练习的时候注意到了Java里面的 ...
- Java中math类的常用函数
Java中math类的常用函数 在 Java 中 Math 类封装了常用的数学运算,提供了基本的数学操作,如指数.对数.平方根和三角函数等 只要在源文件的顶部加上下面这行代码就不必在数学方法名和常量名 ...
- Java中的Random()函数
今天在做Java练习的时候注意到了Java里面的一个随机函数——Random,刚开始只是知道这个函数具有随机取值的作用,于是上网搜索了资料一番,做了一下一些关于Random函数的总结: Java中 ...
- Java中的Random()函数 【转载】
今天在做Java练习的时候注意到了Java里面的一个随机函数——Random,刚开始只是知道这个函数具有随机取值的作用,于是上网搜索了资料一番,做了一下一些关于Random函数的总结: J ...
- java中的==操作符和equals函数
基本规则 “==”操作符的使用需要分成两种情况 判值类型相等 这一点很好理解,两个值类型代表的数值相等,则“==”表达式返回true “==”可以用与不同值类型的比较,语言会自动进行类型转换 判引用类 ...
- Java中大数的使用与Java入门(NCPC-Intergalactic Bidding)
引入 前几天参加湖南多校的比赛,其中有这样一道题,需要使用高精度,同时需要排序,如果用c++实现的话,重载运算符很麻烦,于是直接学习了一发怎样用Java写大数,同时也算是学习Java基本常识了 题目 ...
- java中大数类的学习
java中提供了大数类BigInteger和BigDecimal分别表示大整数类和大浮点数类,这两个类都在java.math.*包中,因此每次必须在开头处引用该包. 一.BigInteger构造函数: ...
- java中String字符串的替换函数:replace与replaceAll的区别
例如有如下x的字符串 String x = "[kllkklk\\kk\\kllkk]";要将里面的“kk”替换为++,可以使用两种方法得到相同的结果 replace(CharSe ...
- java 中的SimpleDateFormat、Date函数以及字符串和Date类型互转
SimpleDateFormat是一个以与语言环境有关的方式来格式化和解析日期的具体类.它允许进行格式化(日期 -> 文本).解析(文本 -> 日期)和规范化. SimpleDateFor ...
随机推荐
- LAMP第一部分安装mysql -apache -php
1. 安装mysqlcd /usr/local/src/ 免安装编译二进制的包wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-l ...
- 6个超实用的PHP代码片段
一.黑名单过滤 function is_spam($text, $file, $split = ':', $regex = false){ $handle = fopen($file, 'rb'); ...
- 第二篇:python基础_2
本篇内容 数字 字符串 元祖 字典 列表 集合 for循环 二进制 字符编码 文件处理 一.数字 1.int(整型) 在32位机器上,整数的位数为32位,取值范围为-2**31-2**31-1,即-2 ...
- 文本文件txt生成excel
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...
- 深入理解 Flutter 的编译原理与优化
阿里妹导读:对于开发者而言,Flutter工程和我们的Android/iOS工程有何差别?Flutter的渲染和事件传递机制如何工作?构建缓慢或出错又如何去定位,修改和生效呢?凡此种种,都需要对Flu ...
- BZOJ2132 圈地计划 【最小割】
题目 最近房地产商GDOI(Group of Dumbbells Or Idiots)从NOI(Nuts Old Idiots)手中得到了一块开发土地.据了解, 这块土地是一块矩形的区域,可以纵横划分 ...
- form+iframe+file 页面无刷新上传文件并获取返回值
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- Windows开发
1. 介绍 这里简单介绍了Windows应用程序开发的基础知识 2. 基础 Windows下的应用程序有控制台程序和Win32窗口程序,这里讲的是Win32窗口程序 Windows提供了相关静态库(L ...
- 使用layer的iframe层提交表单后,需要关闭当前的iframe层,然后刷新父页面的方法2
<input type="button" onclick="edit(${it.id?c})" class="layui-btn layui-b ...
- C#使用DirectoryEntry类操作Windows帐户
1.创建windows帐户 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 /// <summary> /// 创建Windows帐户 /// </summa ...