李长全

导航

2017年4月21日 #

小面试题

摘要: 这段代码执行,会在控制台输出什么内容? 为什么是数组,不是地址值? 附上源码,自己瞅去!!!!下班了,不写了 阅读全文

posted @ 2017-04-21 17:37 李长全 阅读(131) 评论(0) 推荐(0) 编辑

获取10个1-20的随机数,要求不能重复

摘要: 两种方式 打印结果: [1,16,19,2,3,5,6,7,8] 阅读全文

posted @ 2017-04-21 16:57 李长全 阅读(542) 评论(0) 推荐(0) 编辑

写一个逆序数组

摘要: @Test public void demo1() {int[] arr = { 1, 2, 3, 4, 5 }; for (int start = 0, end = arr.length - 1; start < end; start++, end--) { int temp = arr[star 阅读全文

posted @ 2017-04-21 16:22 李长全 阅读(181) 评论(0) 推荐(0) 编辑

迭代器---二维数组叠加

摘要: //迭代器 @Test public void demo4() { ArrayList list = new ArrayList(); list.add(1); list.add(3); list.add(2); list.add(4); list.add(5); Iterator iterator = list.iterator(); while (it... 阅读全文

posted @ 2017-04-21 16:20 李长全 阅读(420) 评论(0) 推荐(0) 编辑

排序

摘要: @Test public void demo6(){ int [] arr = {1,2,3,4,5}; for(int x = 0 ;x<arr.length-1;x++){ for(int y = 1;y<arr.length;y++){ if(arr[x]>arr[y]){ int temp 阅读全文

posted @ 2017-04-21 16:19 李长全 阅读(120) 评论(0) 推荐(0) 编辑

字符串倒序

摘要: @Test public void demo7(){StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("12345"); StringBuffer reverse = stringBuffer.reverse(); 阅读全文

posted @ 2017-04-21 16:18 李长全 阅读(192) 评论(0) 推荐(0) 编辑

对字符串进行排序

摘要: @Test public void demo8(){ String s = "678912345"; char[] charArray = s.toCharArray(); for(int x = 0;x < charArray.length; x++){ for(int y =0; y<charArray.length-1;y++){ if(charArray[... 阅读全文

posted @ 2017-04-21 16:17 李长全 阅读(808) 评论(0) 推荐(0) 编辑

二分法查找

摘要: 阅读全文

posted @ 2017-04-21 16:15 李长全 阅读(114) 评论(0) 推荐(0) 编辑