摘要: package com.bjpowernode.t01; import java.util.Arrays; /* * 二分法查找 * 首先要确保该数组是排好序的 */public class TestArray12 { public static void main(String[] args) { 阅读全文
posted @ 2018-08-27 18:25 Monica_维维 阅读(140) 评论(0) 推荐(0) 编辑
摘要: package com.bjpowernode.t01; import java.util.Arrays; /** * 使用jdk中提供的排序方式 * */public class TestArray11 { public static void main(String[] args) { int[ 阅读全文
posted @ 2018-08-27 17:51 Monica_维维 阅读(715) 评论(0) 推荐(0) 编辑
摘要: package com.bjpowernode.t01; /* * 选择排序 */public class TestArray10 { public static void main(String[] args) { int[] a = {4,2,7,3,6}; //外层 for(int i=0; 阅读全文
posted @ 2018-08-27 17:50 Monica_维维 阅读(87) 评论(0) 推荐(0) 编辑
摘要: package com.bjpowernode.t01; /* * 冒泡排序 */public class TestArray { public static void main(String[] args) { int[] a = {4,2,7,3,6}; //外层for循环控制比较的轮数 for 阅读全文
posted @ 2018-08-27 17:48 Monica_维维 阅读(70) 评论(0) 推荐(0) 编辑
摘要: package chapter7; import java.util.Arrays; public class TestArray07 { public static void main(String[] args) { // 数组扩容 int[] a = { 2, 5, 6, 3, 7 }; // 阅读全文
posted @ 2018-08-27 16:42 Monica_维维 阅读(206) 评论(0) 推荐(0) 编辑
摘要: package chapter7; /* * jdk提供的扩容方法 * System.arraycopy */public class TestArrayjdk { public static void main(String[] args) { // 定义数组 int[] a = { 2, 8, 阅读全文
posted @ 2018-08-27 15:24 Monica_维维 阅读(306) 评论(0) 推荐(0) 编辑
摘要: package chapter7;//数组扩容 public class TestArray { public static void main(String[] args) { // 创建数组 int[] a = { 1, 4, 8, 6, 9 }; // 扩容数组 int[] b = new i 阅读全文
posted @ 2018-08-27 14:33 Monica_维维 阅读(129) 评论(0) 推荐(0) 编辑
摘要: package chapter7;/* * 面试题 */public class TestArray04 { public static void main(String[] args) { //数组可以看做是引用数据类型 int[] a = { 1, 2, 3 }; //因为a和b同时指向同一个数 阅读全文
posted @ 2018-08-27 11:39 Monica_维维 阅读(102) 评论(0) 推荐(0) 编辑
摘要: /* 动态数组可以扩容 静态的已经声明了数组长度,无法进行扩容 */ package chapter7; //数组的创建public class ArrayTest01 { public static void main(String[] args) { // int[5]:下标从0-1-2-3-4 阅读全文
posted @ 2018-08-27 10:24 Monica_维维 阅读(1077) 评论(0) 推荐(0) 编辑
摘要: package chapter7; /* * 找出数组中的最大值 */public class TestArrayMax { public static void main(String[] args) { // 定义一个数组 int[] a = { 1, 9, 5, 4, 3, 0, 2 }; / 阅读全文
posted @ 2018-08-27 00:33 Monica_维维 阅读(3281) 评论(0) 推荐(0) 编辑