上一页 1 2 3 4 5 6 7 ··· 31 下一页
摘要: 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 一块 阅读(188) 评论(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 一块 阅读(88) 评论(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) 编辑
摘要: public static void main(String[] args) { System.out.println(Math.PI); System.out.println(Math.abs(-10));//取绝对值 System.out.println(Math.ceil(12.3));//向 阅读全文
posted @ 2021-04-19 20:33 一块 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Pattern p = Pattern.compile("a*b"); a*b 代表a出现一次到多次 后面跟个b Pattern.compile()方法获取正则表达式 Matcher m = p.matcher("aaaaab"); 调用方法matcher()传入一个字符串 返回一个Matcher 阅读全文
posted @ 2021-04-11 20:34 一块 阅读(285) 评论(0) 推荐(0) 编辑
摘要: String regex = "(.)\\1(.)\\2"; 点代表任意字符 \\1代表第一组又出现一次 \\2代表第二种又出现一次 String regex = "(.)\\1+"; 点代表任意字符 \\1+代表第一组又出现一次或多次 String regex = "\\.+"; \\.+ 代表点 阅读全文
posted @ 2021-04-11 20:06 一块 阅读(99) 评论(0) 推荐(0) 编辑
摘要: public static void main(String[] args) {// String类的的功能:public String replaceAll(String regex,String replacement) String s = "wo12shi55mli"; String reg 阅读全文
posted @ 2021-04-07 21:29 一块 阅读(78) 评论(0) 推荐(0) 编辑
摘要: //1.将字符串通过正则表达式切割成字符串数组 String ss = "91 27 46 38 50"; String [] arr = ss.split(" "); //2.将字符串转换成数字Integer.parseInt(arr[i])并将其存储在一个等长度的int数组中 int [] ar 阅读全文
posted @ 2021-04-07 21:15 一块 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 常见对象(字符类演示) String regex = "[abc]";//[]代表单个字符,分别代表a b c 三个字符 String regex1 = "[^abc]";//取反,[]代表单个字符,除a b c 三个字符以外的单个字符 String regex2 = "[a-zA-Z]";//[] 阅读全文
posted @ 2021-04-06 21:39 一块 阅读(271) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 31 下一页