博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Math类、Random类、System类、BigInteger类、BigDecimal类、Date类、SimpleDateFormat、Calendar类...
阅读量:4322 次
发布时间:2019-06-06

本文共 2369 字,大约阅读时间需要 7 分钟。

Math类
* A:Math类概述
 * Math 类包含用于执行基本数学运算的方法,如初等指数、对数、平方根和三角函数。
* B:成员方法
 * public static int abs(int a)
 * public static double ceil(double a)
 * public static double floor(double a)
 * public static int max(int a,int b) min自学
 * public static double pow(double a,double b)
 * public static double random()
 * public static int round(float a) 参数为double的自学
 * public static double sqrt(double a)
Random类
* A:Random类的概述
 * 此类用于产生随机数如果用相同的种子创建两个 Random 实例,
 * 则对每个实例进行相同的方法调用序列,它们将生成并返回相同的数字序列。
* B:构造方法
 * public Random()
 * public Random(long seed)
* C:成员方法
 * public int nextInt()
 * public int nextInt(int n)(重点掌握)
System类
* B:成员方法
 * public static void gc()
 * public static void exit(int status)
 * public static long currentTimeMillis()
 * pubiic static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
BigInteger类
 * 可以让超过Integer范围内的数据进行运算
* B:构造方法
 * public BigInteger(String val)
* C:成员方法
 * 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)
BigDecimal类
* A:BigDecimal的概述
 * 由于在运算的时候,float类型和double很容易丢失精度,演示案例。
 * 所以,为了能精确的表示、计算浮点数,Java提供了BigDecimal
 * 不可变的、任意精度的有符号十进制数。
* B:构造方法
 * public BigDecimal(String val)
* C:成员方法
 * public BigDecimal add(BigDecimal augend)
 * public BigDecimal subtract(BigDecimal subtrahend)
 * public BigDecimal multiply(BigDecimal multiplicand)
 * public BigDecimal divide(BigDecimal divisor)
Date类
* A:Date类的概述
 * 类 Date 表示特定的瞬间,精确到毫秒。
* B:构造方法
 * public Date()
 * public Date(long date)
* C:成员方法
 * public long getTime()
 * public void setTime(long time)
SimpleDateFormat类实现日期和字符串的相互转换
* A:DateFormat类的概述
 * DateFormat 是日期/时间格式化子类的抽象类,它以与语言无关的方式格式化并解析日期或时间。是抽象类,所以使用其子类SimpleDateFormat
* B:SimpleDateFormat构造方法
 * public SimpleDateFormat()
 * public SimpleDateFormat(String pattern)
* C:成员方法
 * public final String format(Date date)
 * public Date parse(String source)
 
Calendar类的概述和获取日期的方法
* A:Calendar类的概述
 * Calendar 类是一个抽象类,它为特定瞬间与一组诸如 YEAR、MONTH、DAY_OF_MONTH、HOUR 等日历字段之间的转换提供了一些方法,并为操作日历字段(例如获得下星期的日期)提供了一些方法。
* B:成员方法
 * public static Calendar getInstance()
 * public int get(int field)
Calendar类的add()和set()方法
* A:成员方法
 * public void add(int field,int amount)
 * public final void set(int year,int month,int date)

转载于:https://www.cnblogs.com/wuxu/p/10649396.html

你可能感兴趣的文章
关于NSDictionary的一点感悟
查看>>
CSS长度单位:px和pt的区别
查看>>
50.分治算法练习: 二分算法: 2703 奶牛代理商 XII
查看>>
Wampserver 403问题
查看>>
mysql日志详细解析
查看>>
解决关闭app权限弹框后无法识别页面对象问题
查看>>
struts2_对Map进行双层迭代
查看>>
asp.net是什么?asp.net、vb.net和c#.net有什么区别?
查看>>
PhotoView
查看>>
hdu 1735(贪心) 统计字数
查看>>
iOS 系统框架结构图
查看>>
uml系列(六)——行为图:活动&状态
查看>>
Learning Deconvolution Network for Semantic Segme小结
查看>>
Leetcode 424.替换后的最长重复字符
查看>>
第二阶段:2.商业需求文档MRD:1.M版本管理
查看>>
我爱Java系列---【单列集合和双列集合总结】
查看>>
新开始
查看>>
git - 如何从项目中删除git跟踪
查看>>
MacBook Air密码忘了,苹果电脑密码忘了怎么办
查看>>
PHP二维数组排序
查看>>