![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
9nhb5
这个作者很懒,什么都没留下…
展开
-
String
1str.indexOf(“a”);//第一次出现a的索引2str.lastIndexOf(“a”);//最后一次出现a的索引原创 2018-12-01 16:52:13 · 131 阅读 · 1 评论 -
过滤器Filter和拦截器
可以通过过滤器实现记录指定请求路径下的方法的执行时间等需求Filter代码package cn.nhb.upload.util;import org.springframework.boot.web.servlet.FilterRegistrationBean;import org.springframework.context.annotation.Bean;import org.s...原创 2019-01-09 15:28:34 · 118 阅读 · 0 评论 -
java.lang.system的一些方法
Properties properties = System.getProperties();获取系统名--------Windows 7String property = properties.getProperty("os.name");原创 2019-01-14 10:33:00 · 257 阅读 · 0 评论 -
HashMap和HashSet
HashMapMap中不允许有重复的键Map接口有2个实现,分为HashMap和TreeMapTreeMap保存了数据的排列次序,HashMap不能。HashMap本身是非线程安全的,但是collection框架提供方法可以保证HashMap是线程安全的。put(key,value)添加键值对HashSet不允许集合中有重复值add(Object o)添加对象...原创 2019-01-03 09:28:36 · 124 阅读 · 0 评论 -
Servlet
Request路径:http://localhost:5002/login/testrequest.getServerName();//获取域名(即端口前面的内容):localhostrequest.getServletPath();//获取访问路径(即端口后面的内容):/login/test...原创 2018-12-24 18:34:34 · 110 阅读 · 0 评论 -
Java时间格式与时间戳的互相转化
时间戳时间Date date = new Date(1540535801*1000L);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//时间戳转换为指定的时间格式System.out.println(sdf.format(date));String time = "2018-10-26 14:36:...原创 2018-12-27 20:45:38 · 1044 阅读 · 0 评论 -
JSch实现SFTP文件上传
引入jar包 <!--tomcat上传到服务器工具 --> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-ftp</artifactId> <...原创 2018-12-27 18:05:19 · 711 阅读 · 0 评论 -
Random随机数
//生成六位随机验证码 String code1 = String.valueOf(new Random().nextInt(899999) + 100000);原创 2018-12-13 10:59:35 · 355 阅读 · 0 评论 -
定时任务
1使用自带的定时任务时需要在启动类中添加注解@EnableScheduling2在方法上注明即可 @Scheduled(cron = "0/5 * * * * ? ")//每个五秒执行一次原创 2018-12-05 17:21:20 · 92 阅读 · 0 评论 -
BigDecimal商用计算
加减乘除用法 BigDecimal a = new BigDecimal("1.2"); BigDecimal b = new BigDecimal("2.3"); System.out.println(a.toPlainString()); //转换为String类型 System.out.println(a.add(b));//加...原创 2019-06-11 15:38:52 · 216 阅读 · 0 评论