随笔分类 -  java

摘要:1. 获得计算机有几个内核 阅读全文
posted @ 2016-10-09 15:19 勿妄 阅读(210) 评论(0) 推荐(0)
摘要:1. Maven依赖 阅读全文
posted @ 2016-10-08 12:00 勿妄 阅读(1747) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2015-09-10 20:14 勿妄
摘要:1.每天0点5分开始,以后每隔15分钟启动一次,23:50停止: 0 5/15 0-23 * * * cron表达式,由于从5分开始,每15分钟执行一次,到了23点的最后一次执行时间正好是23:50.也就是说23:50的时候还会出发一次2.8:00~20:00,每两小时触发一次: 0 0 8-... 阅读全文
posted @ 2015-08-17 20:44 勿妄 阅读(1777) 评论(0) 推荐(0)
摘要:1. 取某个范围的任意数public static String getRandom(int min, int max){Random random = new Random();int s = random.nextInt(max) % (max - min + 1) + min;return S... 阅读全文
posted @ 2015-07-10 10:11 勿妄 阅读(129) 评论(0) 推荐(0)
摘要:1.准备数据,这里我从数据库读取一个带有html标签和script脚本的数据代码:@Before public void init(){ SQLService sqlService = new SQLService(); sqlService.regist(null... 阅读全文
posted @ 2015-05-11 16:35 勿妄 阅读(678) 评论(0) 推荐(0)
摘要:参考: Comparison method violates its general contract Comparison method violates its general contract! 比较器报错:Comparison method violates its general ... 阅读全文
posted @ 2015-05-08 15:06 勿妄 阅读(797) 评论(0) 推荐(0)
摘要:package com.date;import java.text.DateFormatSymbols;import java.util.Calendar;import org.junit.Test;public class CalendarTest { /** * 打印当前月的日历 ... 阅读全文
posted @ 2015-04-17 11:41 勿妄 阅读(627) 评论(0) 推荐(0)
摘要:1.测试给定的正则表达式是否匹配输入的字符串,这里该正则表达式只使用一次 private String regex ; private String input; @Before public void init(){ regex = "\\[{0,1}([\u4e00-\... 阅读全文
posted @ 2015-03-16 11:07 勿妄 阅读(449) 评论(0) 推荐(0)
摘要:将字符转换为unicode码: /** * unicode转义字符 * @param ch * @param out */ public static void unicodeEscape(int ch, CharArr out) { out.write('\\'); ... 阅读全文
posted @ 2015-02-07 17:27 勿妄 阅读(777) 评论(0) 推荐(0)
摘要:1.解析图片@Test public void test1Image() throws IOException, SAXException, TikaException{ String filePath = "src/main/resources/baby.jpg"; ... 阅读全文
posted @ 2015-02-03 15:23 勿妄 阅读(343) 评论(0) 推荐(0)
摘要:public static void main( String[] args ) throws IOException { String str = "a|b"; String[] strs = str.split("[|]"); System.out... 阅读全文
posted @ 2015-02-02 14:34 勿妄 阅读(890) 评论(0) 推荐(0)
摘要:InputStream 从输入数据流中读取字节,这里主要说明它的read方法. * InputStream这个抽象类是所有代表字节输入数据流的类的父类.应用的话需要定义一个InputStream的子类, * 这个子类需要提供一个方法用来返回输入流的下一个字节.jdk API中对InputStream... 阅读全文
posted @ 2015-01-12 10:52 勿妄 阅读(273) 评论(0) 推荐(0)
摘要://将字符转换为Unicode码中字符对应十进制数字int byte0 = 'A' & 0xff;//byte0=65参考文档:http://baike.baidu.com/view/2602518.htm http://blog.idf.cn/2014/02/unicode-isnt-har... 阅读全文
posted @ 2015-01-11 19:06 勿妄 阅读(2447) 评论(0) 推荐(0)
摘要:参考:http://zh.wikipedia.org/zh-cn/Base64 http://www.cnblogs.com/hongru/archive/2012/01/14/2321397.html http://www.cnblogs.com/luguo3000/p/3940197.h... 阅读全文
posted @ 2015-01-11 17:01 勿妄 阅读(318) 评论(0) 推荐(0)
摘要:代码如下:package com.xin.stream;import java.io.BufferedReader;import java.io.ByteArrayInputStream;import java.io.IOException;import java.io.InputStream;im... 阅读全文
posted @ 2014-10-11 13:47 勿妄 阅读(1490) 评论(0) 推荐(0)
摘要:原文链接地址:http://www.blogjava.net/supercrsky/articles/247449.html针对JDK中的URLConnection连接Servlet的问题,网上有虽然有所涉及,但是只是说明了某一个或几个问题,是以FAQ的方式来解决的,而且比较零散,现在对这个类的使用... 阅读全文
posted @ 2014-10-11 10:30 勿妄 阅读(269) 评论(0) 推荐(0)
摘要:Log4J的配置文件(Configuration File)就是用来设置记录器的级别、存放器和布局的,它可接key=value格式的设置或xml格式的设置信息。通过配置,可以创建出Log4J的运行环境。1. 配置文件Log4J配置文件的基本格式如下:#配置根Loggerlog4j.rootLogge... 阅读全文
posted @ 2014-08-08 14:45 勿妄 阅读(437) 评论(0) 推荐(0)
摘要:/** * 汉字转换为拼音 包含多音字,包含生母zh,ch,sh的 */ public void toPinYinAll(){ String initials = "zh,ch,sh"; //返回汉语拼音的全拼 List result ... 阅读全文
posted @ 2014-08-06 17:28 勿妄 阅读(356) 评论(0) 推荐(0)
摘要:1 public static String[] array_unique(String[] a) {2 Set set = new HashSet();3 set.addAll(Arrays.asList(a));4 return set.toArray(new String[0]);5 } 阅读全文
posted @ 2014-08-06 16:37 勿妄 阅读(209) 评论(0) 推荐(0)