随笔分类 -  java

摘要:先了解一下用到的位运算符:https://www.cnblogs.com/gavinYang/p/11196492.html 一、初始化 1.无参构造函数: 2.指定初始化大小和负载因子: 3.指定初始化大小(会调用2) 二、put元素(转红黑树和put一个TreeNode时待补充) 三、get元素 阅读全文
posted @ 2019-11-01 17:41 努力挣扎的小兵 阅读(193) 评论(0) 推荐(0)
摘要://冒泡排序 public static void sort1(int[] arr){ for (int i=0;iarr[j]){ int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } } } }... 阅读全文
posted @ 2019-07-17 18:12 努力挣扎的小兵 阅读(536) 评论(0) 推荐(0)
摘要://需要时加锁,双重校验 class CustomSingleton{ private static CustomSingleton customSingleton = null; private CustomSingleton(){}; public static CustomSingleton getCustomSingleton(){ if(custom... 阅读全文
posted @ 2019-07-17 17:11 努力挣扎的小兵 阅读(169) 评论(0) 推荐(0)
摘要:public class TestCglibProxy { public static void main(String[] args) { UserService userService = new UserServiceImpl(); CglibProxy cglibProxy = new CglibProxy(); Enha... 阅读全文
posted @ 2019-07-17 17:04 努力挣扎的小兵 阅读(138) 评论(0) 推荐(0)
摘要:public class TestJdkProxy { public static void main(String[] args) { UserService userService = new UserServiceImpl(); JdkProxy jdkProxy = new JdkProxy(userService); Us... 阅读全文
posted @ 2019-07-17 17:02 努力挣扎的小兵 阅读(133) 评论(0) 推荐(0)
摘要:回文:aba abcba 双重循环遍历字符串,外层从第一个开始找,内层循环从最后一个开始找。当外层的字符和内存循环的字符相等时则组成新的数组,判断是否是回文 阅读全文
posted @ 2019-07-17 16:34 努力挣扎的小兵 阅读(292) 评论(0) 推荐(0)
摘要:public static void main(String[] args) throws IOException { String path = "C:/Users/yang/Desktop/source.jpg"; BufferedImage bufferedImage = ImageIO.read(new File(path)); ... 阅读全文
posted @ 2019-07-16 21:52 努力挣扎的小兵 阅读(3623) 评论(0) 推荐(0)
摘要:--Xmx2048m: 设置JVM最大可用内存为2048M,超出了这个设置值,就会抛出OutOfMemory 异常--Xms2048m: 设置JVM初始分配的内存的大小为2048M。此值可以设置与-Xmx相同,以避免每次垃圾回收完成后JVM重新分配内存。-Xmn2g:设置年轻代大小为2G。整个JVM 阅读全文
posted @ 2019-07-16 21:50 努力挣扎的小兵 阅读(859) 评论(0) 推荐(0)
摘要:执行jar包,默认执行javafile中指定的main程序java -jar jar包例如 java -jar test.jar执行依赖其他jar包的class: java -cp .;E:\tools\apache-maven-3.2.1\repository\log4j\log4j\1.2.17 阅读全文
posted @ 2019-07-16 17:55 努力挣扎的小兵 阅读(8094) 评论(0) 推荐(2)
摘要:/* * * 每一个位上对应的数字 * …… 10 9 8 7 6 5 4 3 2 1 0 分别表示2的N次方 * …… 1024 512 256 128 64 32 16 8 4 2 1 *... 阅读全文
posted @ 2019-07-16 17:54 努力挣扎的小兵 阅读(1526) 评论(0) 推荐(0)
摘要:/* 6的二进制:110 11的二进制:1011 */ // 与运算符: 相同位上都为1 则该位为1,否则0 System.out.println(6 & 11);//等价于 0110 & 1011 = 0010 ; 0010 转二进制等于2 // 或运算符: 相同位上有一个位1则该位为1,否则0 Sy... 阅读全文
posted @ 2019-07-16 17:53 努力挣扎的小兵 阅读(226) 评论(0) 推荐(0)
摘要:public void saveToFile(String destUrl) { FileOutputStream fos = null; BufferedInputStream bis = null; HttpURLConnection httpUrl = null; URL url = null; intBUFFER_SI... 阅读全文
posted @ 2019-07-16 17:42 努力挣扎的小兵 阅读(281) 评论(0) 推荐(0)
摘要:先将100000000*1000 的结果转化为二进制: 10111 01001000 01110110 11101000 00000000 由于int类型表示的最大值是32位即:01001000 01110110 11101000 00000000,前面的10111属于溢出部分 将01001000 阅读全文
posted @ 2019-07-16 17:35 努力挣扎的小兵 阅读(1423) 评论(0) 推荐(0)
摘要:依赖jar: <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.9.1</version> </dependency> <dependency 阅读全文
posted @ 2018-01-01 21:10 努力挣扎的小兵 阅读(2188) 评论(0) 推荐(0)
摘要:依赖jar <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> Level:日志输出的几种级别 FATAL 0 ERROR 3 WAR 阅读全文
posted @ 2018-01-01 21:07 努力挣扎的小兵 阅读(225) 评论(0) 推荐(0)
摘要:依赖jar包 <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core 阅读全文
posted @ 2018-01-01 21:02 努力挣扎的小兵 阅读(3037) 评论(0) 推荐(0)
摘要:获取异常信息e.printStackTrace()的内容最近做项目的时候需要记录操作的日志,但是记录异常信息的是发现使用e.getMessage()根本无法满足需要,并且e.getMessage()有时获得的信息根本无法知道具体的错误信息,那么这个时候我们就要获得e.printStackTrace(... 阅读全文
posted @ 2014-07-01 16:54 努力挣扎的小兵 阅读(3837) 评论(0) 推荐(0)
摘要:java io读写文件相关阅读:http://www.cnblogs.com/wing011203/archive/2013/05/03/3056535.htmlpublic class DemoIO { public static byte[] readForInputStream(File file) throws IOException{ InputStream in = new FileInputStream(file); byte b[]=new byte[(int)file.length()]; //创建合适文件大小的数组 ... 阅读全文
posted @ 2014-03-02 20:40 努力挣扎的小兵 阅读(214) 评论(0) 推荐(0)
摘要:JXL读取,写入Excel2003 相关阅读:poi 读写excel2003:http://www.cnblogs.com/gavinYang/p/3576739.htmlpoi 读写excel2007:http://www.cnblogs.com/gavinYang/p/3576741.html 阅读全文
posted @ 2014-03-02 15:13 努力挣扎的小兵 阅读(2840) 评论(0) 推荐(0)
摘要:Java poi读取,写入Excel2007相关阅读:poi读写Excel2003:http://www.cnblogs.com/gavinYang/p/3576739.htmljxl读写excel2003/2007:http://www.cnblogs.com/gavinYang/p/3576819.htmlpackage com.gavin.operational.excle;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import j 阅读全文
posted @ 2014-03-02 14:06 努力挣扎的小兵 阅读(12231) 评论(0) 推荐(0)