摘要: 表示特定的瞬间,精确到毫秒。 util包下,不能导入sql包下的。 Date d = new Date(); //获取到系统当前时间 Date d1 = new Date(0); //获取时间:1970年1月1日 System.out.println(d); System.out.println(d 阅读全文
posted @ 2021-04-20 21:38 一块 阅读(171) 评论(0) 推荐(0) 编辑
摘要: BigDecimal类可以用来更精确的求出小数之间的加减乘除,取除数和余数。 方法一: BigDecimal bd1 = new BigDecimal("1.5"); 构造方法中传入字符串,才能精确计算,开发中推荐 BigDecimal bd2 = new BigDecimal("3.0"); Sy 阅读全文
posted @ 2021-04-20 21:11 一块 阅读(134) 评论(0) 推荐(0) 编辑
摘要: BigInteger的概述:可以让超过Integer 范围内的数据进行运算。 构造方法: public BIGInteger (String val); 通过构造方法接收String类型的数字 String s = "123456789987654321123"; BigInteger b = ne 阅读全文
posted @ 2021-04-20 20:54 一块 阅读(189) 评论(0) 推荐(0) 编辑
摘要: long start = System.currentTimeMillis(); 程序开始执行的时间点 单位:毫秒 for(int i =0;i<1000;i++) { System.out.println("*"); } long end = System.currentTimeMillis(); 阅读全文
posted @ 2021-04-20 20:34 一块 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Random r = new Random(); for (int i = 0; i < 10; i++) { System.out.println(r.nextInt(100));//1-100之间生成随机数 } 阅读全文
posted @ 2021-04-20 20:03 一块 阅读(63) 评论(0) 推荐(0) 编辑