上一页 1 2 3 4 5 6 7 ··· 73 下一页
摘要: apache的文件名工具类FilenameUtils org.apache.commons.io.FilenameUtils。 FileUtils和FilenameUtils分别是Apache对文件名和文件的封装,两者可以配合使用。 <dependency> <groupId>commons-io</groupId> <artifactId>commo 阅读全文
posted @ 2023-11-28 08:49 残城碎梦 阅读(132) 评论(0) 推荐(0) 编辑
摘要: apache的文件工具类FileUtils org.apache.commons.io.FileUtils是apache提供用来操作文件的工具类,可以简化文件操作。 <!-- FileUtils --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</art 阅读全文
posted @ 2023-11-28 08:40 残城碎梦 阅读(42) 评论(0) 推荐(0) 编辑
摘要: apache的时间监视器StopWatch org.apache.commons.lang3.time.StopWatch。 在编程过程中,常常需要计算某段程序的运行时间,常见做法是在目标程序段的前后分别记录系统毫微秒时间,通过取差得到时间差,现在有一种更好的方式是:使用apache提供的StopWatch。 相对于System.curren 阅读全文
posted @ 2023-11-27 08:45 残城碎梦 阅读(144) 评论(0) 推荐(0) 编辑
摘要: apache的时间工具类DateUtils org.apache.commons.lang3.DateUtils是Apache提供的时间工具类。 <!-- StringUtils、NumberUtils等工具类 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId 阅读全文
posted @ 2023-11-26 19:53 残城碎梦 阅读(366) 评论(0) 推荐(0) 编辑
摘要: apache的数组工具类ArrayUtils org.apache.commons.lang3.ArrayUtils是Apache提供的数组工具类。 <!-- StringUtils、NumberUtils等工具类 --> <dependency> <groupId>org.apache.commons</groupId> <artifactI 阅读全文
posted @ 2023-11-26 16:15 残城碎梦 阅读(12) 评论(0) 推荐(0) 编辑
摘要: apache的数字工具类NumberUtils org.apache.commons.lang3.NumberUtils <!-- StringUtils、NumberUtils等工具类 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3 阅读全文
posted @ 2023-11-26 11:22 残城碎梦 阅读(18) 评论(0) 推荐(0) 编辑
摘要: apache的字符串工具类StringUtils org.apache.commons.lang3.StringUtils。 <!-- StringUtils、NumberUtils等工具类 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang 阅读全文
posted @ 2023-11-26 11:09 残城碎梦 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 文件读取和写入工具类 Java IO流共涉及40多个类,但基类只有四个: InputStream / Reader :所有输入流的基类,前者是字节输入流,后者是字符输 入流。 OutputStream / Writer :所有输出流的基类,前者是字节输出流,后者是字符输出 流。 BufferedReader整行读取 pu 阅读全文
posted @ 2023-11-26 10:56 残城碎梦 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 实现倒计时的4种方式 使用TimeUnit实现倒计时 public static void countDown(int sec) throws InterruptedException { while (sec > 0) { System.out.println(sec + "s"); TimeUnit.SECONDS. 阅读全文
posted @ 2023-11-26 10:49 残城碎梦 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 汉字转拼音工具类 汉字转拼音工具类,拼音首字母大写。 需要注意的是,由于用到了pinyin4j,因此需要导包: <!--汉字转拼音--> <dependency> <groupId>org.clojars.cbilson</groupId> <artifactId>pinyin4j</artifactId> <ver 阅读全文
posted @ 2023-11-26 09:02 残城碎梦 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 身份证校验器 身份证号码校验规则: 1、身份证号码是18位数,分别是17位数字和1位校验码。 具体含义分别是:6位地址码+8位出生日期+3位顺序码+1位校验码,校验码可能为字母 2、顺序码如果是奇数代表男性,偶数代表女性。 3、最后1位校验码是根据前17位数字算出来的 public final class IdC 阅读全文
posted @ 2023-11-26 08:43 残城碎梦 阅读(36) 评论(0) 推荐(0) 编辑
摘要: apache的BeanUtils <!-- BeanUtils的依赖 --> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.4</version> </dependen 阅读全文
posted @ 2023-11-26 08:37 残城碎梦 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 生成6位随机正整数 使用Random生成随机数 public static String getStringRandom() { Random random = new Random(); String str = String.valueOf(random.nextInt(9)); for (int i = 0; i 阅读全文
posted @ 2023-11-25 21:11 残城碎梦 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 反射工具类 import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Arra 阅读全文
posted @ 2023-11-25 20:19 残城碎梦 阅读(14) 评论(0) 推荐(0) 编辑
摘要: apache的集合工具类CollectionUtils org.apache.commons.collections包下的CollectionUtils工具类。 <!--CollectionUtils --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-co 阅读全文
posted @ 2023-11-25 19:59 残城碎梦 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 文件的压缩与解压缩 Java中提供了ZipOutputStream和GZIPOutputStream类供文件压缩使用。 import java.io.*; import java.nio.charset.Charset; import java.util.Enumeration; import java.util.zi 阅读全文
posted @ 2023-11-25 19:26 残城碎梦 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 用5种方式发起HTTP请求 通过JDK网络类Java.net.HttpURLConnection <!--jackson--> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> 阅读全文
posted @ 2023-11-25 14:37 残城碎梦 阅读(32) 评论(0) 推荐(0) 编辑
摘要: Junit <!--junit--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> Apac 阅读全文
posted @ 2023-11-25 11:28 残城碎梦 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Java中常用的加密方式 加解密算法应用场景 加解密是什么?为什么要加密?加密类型都有哪些?有万能加密么? 1)加密,顾名思义,添加密码,密码的作用是加密保护和安全认证。 如果没有加密,即明文显示,那么很容易导致信息泄露;加密之后,未经授权的用户即使获得了信息,但不知秘钥,仍然无法了解信息的具体内容。 2)加密算法大体上分为 阅读全文
posted @ 2023-11-24 21:41 残城碎梦 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 获取多种日期格式 日期工具类 import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public final class DateUtils 阅读全文
posted @ 2023-11-23 18:18 残城碎梦 阅读(17) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 73 下一页