随笔分类 -  java

摘要:做除法没有指定保留小数点后几位,就会抛出此异常。 因为会除不尽 Non-terminating decimal expansion; no exact representable decimal result. 阅读全文
posted @ 2018-09-20 10:29 jwcc 阅读(425) 评论(0) 推荐(0)
摘要:1.注解的定义:Java文件叫做Annotation,用@interface表示。 2.元注解:@interface上面按需要注解上一些东西,包括@Retention、@Target、@Document、@Inherited四种。 3.注解的保留策略: @Retention(RetentionPol 阅读全文
posted @ 2018-08-09 11:48 jwcc 阅读(407) 评论(0) 推荐(0)
摘要:java创建线程池有两种方法 Executors,ThreadPoolExecutor 不建议Executors去创建,而是通过ThreadPoolExecutor。 Executors各个方法的弊端: 1)newFixedThreadPool和newSingleThreadExecutor: 主要 阅读全文
posted @ 2018-08-09 11:03 jwcc 阅读(153) 评论(0) 推荐(0)
摘要:ik分词器下载地址:https://code.google.com/archive/p/ik-analyzer/downloads 需要FQ 配置文件: IKAnalyzer2012.jar(主 jar 包) IKAnalyzer.cfg.xml(分词器扩展配置文件) stopword.dic(停止 阅读全文
posted @ 2018-08-09 10:48 jwcc 阅读(297) 评论(0) 推荐(0)
摘要:SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String sd = sdf.format(new Date(Long.parseLong("1529045276")*1000)); // *1000 解决1970年问题 System.out.println(sd); 阅读全文
posted @ 2018-06-15 14:51 jwcc 阅读(157) 评论(0) 推荐(0)
摘要:结论: list添加添加的是map的地址 List> list = new ArrayList(); Map map = new HashMap(); for (int a = 0; a >>>>>>>>>>>>>>>>>>> List> list = new ArrayList(); for (int a = 0... 阅读全文
posted @ 2018-06-14 10:55 jwcc 阅读(489) 评论(0) 推荐(0)
摘要:import java.lang.management.ManagementFactory; import java.net.InetAddress; import java.net.NetworkInterface; /** * 名称:IdWorker.java * 描述:分布式自增长ID * * Twitter的 Snowflake JAVA实现方案 * * 核心代码为其IdWork... 阅读全文
posted @ 2018-06-14 10:52 jwcc 阅读(350) 评论(0) 推荐(0)
摘要:import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; public static String xmlToJSON(String xml,int jsonType) { JSONObject obj = new JSONObject(); ... 阅读全文
posted @ 2018-06-14 10:50 jwcc 阅读(599) 评论(0) 推荐(0)
摘要:import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec;//结果与DES算法工具一致 public class DES... 阅读全文
posted @ 2018-06-14 10:49 jwcc 阅读(1606) 评论(0) 推荐(0)
摘要:第一种方式 阅读全文
posted @ 2018-06-14 10:48 jwcc 阅读(140) 评论(0) 推荐(0)
摘要:第一种方法: @RequestMapping(value = "testPersonalValidtor",produces = "application/json;charset=utf-8") 阅读全文
posted @ 2018-06-14 10:47 jwcc 阅读(126) 评论(0) 推荐(0)
摘要:import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; im... 阅读全文
posted @ 2018-06-12 14:25 jwcc 阅读(184) 评论(0) 推荐(0)
摘要:从别的地方copy来的,用着还可以。 阅读全文
posted @ 2018-06-11 18:30 jwcc 阅读(1604) 评论(0) 推荐(0)
摘要:一: 用java自带URL发送 public synchronized JSONObject getJSON(String url2, String param) { try { URL url = new URL(url2); HttpURLConnection con = (HttpURLConnecti... 阅读全文
posted @ 2018-06-08 16:08 jwcc 阅读(19961) 评论(0) 推荐(1)