// Arrays类;静态方法;—直接是类名.方法
int []n={2,5,8,3,9};
//升序排序
Arrays.sort(n);
//以字符串形式输出数组;
System.out.println(Arrays.toString(n));
//查找数组中元素的下标;
int n1=Arrays.binarySearch(n, 5);
System.out.println(n1);//2
//复制数组中的元素;
int []n2=Arrays.copyOf(n, 3);
System.out.println(Arrays.toString(n2));//[2,3,5]
//Collections 集合类;Collections类对集合进行操作的类;
ArrayList list=new ArrayList();
//往集合里一次性添加全部元素
Collections.addAll(list, “abc”,”def”,”hik”);
//翻转
Collections.reverse(list);
System.out.println(list);//hik,def,abc
//升序排序
Collections.sort(list);
System.out.println(list);
//查找,返回索引;
int n9=Collections.binarySearch(list, “def”);
System.out.println(n9);//1
//替换
Collections.replaceAll(list, “abc”,”你好”);
System.out.println(list);