随笔分类 - 工具代码
摘要:一、代码 public class UnitTest { // 金额字符串格式化为千分符 public static String fmtMicrometer(String amount) { DecimalFormat df = null; if (amount.indexOf(".") > 0)
阅读全文
摘要:一、代码 public class DateUtils { public static void main(String[] args) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd")
阅读全文
摘要:1、代码 public class DateUtils { public static void main(String[] args) throws ParseException { String str = "2021-11-01 06:07:08"; Date date = str2Date(
阅读全文
摘要:一、实体类 Cat.java // 省略了 set/get 方法 public class Cat { private Integer id; private String name; private String age; } Dog.java // 省略了 set/get 方法 public c
阅读全文
摘要:java 开发过程中,JS 中 CST 时间与 GMT 时间相差 14 个小时,而后台 CST 时间与 GMT 时间只相差 8 个小时,什么原因造成这种情况呢,要弄清这个问题,我们先看一下 CST 时间和 GMT 时间的概念 GMT(Greenwich Mean Time):代表格林尼治标准时间,这
阅读全文
摘要:1、MultipartFile 转成 InputStream MultipartFile file; byte [] byteArr = file.getBytes(); InputStream inputStream = new ByteArrayInputStream(byteArr);
阅读全文
摘要:Fastjson 相关介绍 支持类型:支持 java bean、集合、Map、日期、Enum、支持泛型、支持自省常用对象: JSON:fastJson 的解析器,用于 JSON 格式字符串与 JSON 对象及 javaBean 之间的转换. JSONObject:fastJson 提供的 json
阅读全文