- 博客(6)
- 收藏
- 关注
转载 Java中List集合去除重复数据的方法
循环list中的所有元素然后删除重复public static List removeDuplicate(List list) {for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {for ( int j = list.size() - 1 ; j > i; j – ) {if...
2019-02-23 21:31:24 270
原创 java:倒序输出数组
//对随机生成的数组使用sort方法进行排序int[] arr=new int[10];for(int i=0;i<arr.length;i++){arr[i]=(int)(Math.random()*10);}System.out.println(Arrays.toString(arr));Arrays.sort(arr);System.out.println(Arrays....
2019-02-18 16:05:44 10233 1
转载 数组倒序三种
直接数组元素对换@Testpublic void testReverseSelf() throws Exception {System.out.println(“use ReverseSelf”);String[] strings = { "ramer", "jelly", "bean", "cake" };System.out.println("\t" + Arrays.toStrin...
2019-02-17 17:48:20 8153 1
转载 java-找出数组里的最大值和最小值
public class Ex01 { public static void main(String[] args) { int[] array = {12,1,2,45,30,50}; int maxIndex = array[0];//定义最大值为该数组的第一个数 int minIndex = array[0];//定义最小值为该数组的第...
2019-02-17 17:04:39 9667
原创 数组toString()方法,在控制台输出输出
import java.util.Arrays;import java.util.Scanner;public class ExerciseArray {public static void main(String[] args){int[] arr=new int[4];Scanner scanner=new Scanner(System.in);System.out.println...
2019-02-17 15:55:05 2257
转载 java怎么在控制台输入数字,并保存到数组里?
import java.util.Scanner;public class Tset {public static void main(String[] args) {System.out.println(“请输入三个数:”);Scanner in = new Scanner(System.in);int[] b=new int[3];for(int i=0;i<b.length...
2019-02-17 15:13:49 12765
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人