Math
System.out.println(Math.PI);
System.out.println(Math.abs(-10));
//向上取整,结果为double
System.out.println(Math.ceil(12.3));
//向下取整,结果为double
System.out.println(Math.floor(12.3));
//获取两个值中的最大值
System.out.println(Math.max(10, 30));
//前面是底数后面是指数,2.0^3.0
System.out.println(Math.pow(2, 3));
//生成0.0-1.0之间的随机数,包括0.0
System.out.println(Math.random());
//四舍五入
System.out.println(Math.round(12.3f));
//开方
System.out.println(Math.sqrt(3));
Random
//1-100的随机数
Random random = new Random(100);
System.out.println(random.nextInt());
System
//垃圾回收
System.gc();
//1970.1.1到现在的时间戳
long start = System.currentTimeMillis();
//终止程序
System.exit(0);
int[] src = {11,2,33,12};
int[] dest = new int[8];
//拷贝内容到 dest
System.arraycopy(src, 0, dest, 0, src.length);
Date
//从1970.1.1开始
Date d1 = new Date(0);
System.out.println(d1.getTime());
DateFormat df1 = DateFormat.getDateInstance();
//创建日期格式化类对象
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年mm月dd日 hh:mm:ss");
System.out.println(sdf.format(d1));
//将时间转为字符串
String str = "1993年10月3日 01:02:03";
try {
Date date = sdf.parse(str);
System.out.println(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}