数字操作类Math,Random,BigInteger,BigDecimal
2016-12-29 15:37
507 查看
数字操作类 Math,
1.java.lang 类 Math
从以下版本开始:
JDK1.0
3.java.math
类 BigInteger
4.java.math
类 BigDecimal
1.java.lang 类 Math
public final class Mathextends Object
Math类包含用于执行基本数学运算的方法,如初等指数、对数、平方根和三角函数。
从以下版本开始:
JDK1.0
public static double random() System.out.println(Math.round(10.45)); //10 System.out.println(Math.round(10.50)); //11 System.out.println(Math.round(-10.45)); //-10 System.out.println(Math.round(-10.50)); //-10 //负数时,超过0.5则进一 System.out.println(Math.round(-10.501)); //-11
public static double pow(double a,double b) System.out.println(Math.pow(10.0,5)); //100000.02.Random
java.util 类 Random
public Random() 创建一个新的随机数生成器。此构造方法将随机数生成器的种子设置为某个值,该值与此构造方法的所有其他调用所用的值完全不同。
public int nextInt(int n)返回一个伪随机数,它是取自此随机数生成器序列的、在 0(包括)和指定值(不包括)之间均匀分布的
int值。
public double nextDouble()返回下一个伪随机数,它是取自此随机数生成器序列的、在
0.0和
1.0之间均匀分布的
double值。
3.java.math
类 BigInteger
4.java.math
类 BigDecimal
相关文章推荐
- JAVA基础复习十四-Math、Random、System、BigInteger、BigDecimal、Date、SimpleDateFormat类
- 重踏学习Java路上_Day14(正则表达式,Math,Random,System,BigInteger,BigDecimal,Date,Calendar)
- day14(正则表达式,Math,Random,System,BigInteger,BigDecimal,Date等)
- Java常用类库--Math、Random、NumberFormat、DecimalFormat、BigInteger、BigDecimal
- 正则表达式,Math,Random,system,BigInteger,BigDecimal,Data/DataFormat,Calender
- 14 API-常用类(正则表达式(Pattern,Matcher),Math,Random,System,BigInteger,BigDecimal,Date/DateFormat,Calendar)
- 简单常用类:Math 、Random、System、Integer、Character、BigInteger、BigDecimal等
- 学习笔记_JavaSE_14_正则表达式、Math、Random、System、BigInteger、BigDecimal、Date与DateFormat、Calendar
- Java中正则表达式和常用的Math、Random、System、BigInteger、BigDecimal、Date/DateFormat、Calendar类的使用
- Java基础 - 正则,Math,Random,System,Date,SimpleDateFormat,Calendar,BigInteger,BigDecimal
- 常见对象_Regex、Math、Random、System、BigInteger、BigDecimal、Date/DateFormat、Calendar总结
- JavaSE----API之常用类(Math、Random、System、BigInteger和BigDecimal、Date和DateFormat、Calendar)
- 处理大数字BigInteger与BigDecimal
- 处理大数字BigInteger与BigDecimal
- JAVA中大数字的的处理:BigInteger和BigDecimal
- java.math包中的BigInteger和BigDecimal
- BigInteger和BigDecimal--数字运算精度的设置
- Java常用类-Math、BigInteger、BigDecimal
- 类:BigDecimal,BigInteger,Math,System
- Java数字操作类(BigInteger)