摘要: java.util.Arrays:操作数组的工具类,里面定义了很多操作数组的方法 判断两个数组是否相等 package lll; import java.util.Arrays; public class Test { public static void main(String[] args) { 阅读全文
posted @ 2022-01-05 20:57 ice--cream 阅读(32) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { int[] arr=new int[]{-11,-22,-3,0,23,2,4,6}; int temp=0; //需要执行多少轮 for(int i= 阅读全文
posted @ 2022-01-05 20:21 ice--cream 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 前提:所要查找的数组必须有序 package lll; public class Test { public static void main(String[] args) { int[] arr=new int[]{1,2,3,4,5,6,7,8,9,10}; //要查找的数 int dest=8 阅读全文
posted @ 2022-01-05 19:16 ice--cream 阅读(24) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { String[] str=new String[]{"aa","bb","cc","dd","ee"}; //要查找的字符串dest String de 阅读全文
posted @ 2022-01-05 17:48 ice--cream 阅读(14) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { int[] arr1=new int[]{1,2,3,4,5,6}; int temp=0; //方法一 for(int i=0;i<arr1.leng 阅读全文
posted @ 2022-01-05 17:32 ice--cream 阅读(41) 评论(0) 推荐(0) 编辑
摘要: JAVA 数组的复制 package lll; public class Test { public static void main(String[] args) { int[] arr1=new int[10]; int[] arr2; //给arr1赋值并打印 for(int i=0;i<ar 阅读全文
posted @ 2022-01-05 15:12 ice--cream 阅读(107) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { int[] arr=new int[10]; //随机赋值 for(int i=0;i<10;i++){ arr[i]=(int)(Math.rando 阅读全文
posted @ 2022-01-05 14:43 ice--cream 阅读(1680) 评论(0) 推荐(0) 编辑
摘要: package lll; public class Test { public static void main(String[] args) { //声明一个二维数组 int[][] yangHui=new int[10][]; for(int i=0;i<yangHui.length;i++){ 阅读全文
posted @ 2022-01-05 14:16 ice--cream 阅读(39) 评论(0) 推荐(0) 编辑