![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
Journey_Sh
这个作者很懒,什么都没留下…
展开
-
Java获取随机数的3种方法
方法1 (数据类型)(最小值+Math.random()*(最大值-最小值+1)) 例: (int)(1+Math.random()*(10-1+1)) 从1到10的int型随数 方法2 获得随机数 for (int i=0;i<30;i++) {System.out.println((int)(1+Math.random()*...转载 2018-09-17 11:56:53 · 16422 阅读 · 0 评论 -
java.text.DecimalFormat类(十进制格式化)
import java.text.DecimalFormat; class FormatDemo{ public void format1(String pattern,double value){ // 声明一个DecimalFormat对象 DecimalFormat df = new Dec...转载 2018-10-10 11:55:58 · 588 阅读 · 0 评论 -
使用java实现去除各种空格
本文给大家汇总介绍了5种java中去除空格的方法,分别是String.trim()、str.replace(" ", "");、replaceAll(" +","");以及自定义的remove函数,非常的简单实用,需要的小伙伴可以参考下。1. String.trim()trim()是去掉首尾空格2.str.replace(" ", ""); 去掉所有空格,包括首尾、中间St转载 2018-09-14 10:01:59 · 14675 阅读 · 0 评论 -
【TestNG】TestNG使用教程详解
一、TestNG介绍TestNG是Java中的一个测试框架, 类似于JUnit 和NUnit, 功能都差不多, 只是功能更加强大,使用也更方便。详细使用说明请参考官方链接:https://testng.org/doc/index.html二、TestNG安装(基于eclipse+maven)工程的pom.xml中需要添加如下内容:<dependency> ...转载 2019-07-08 16:45:56 · 512 阅读 · 0 评论