package com.java; import java.lang.reflect.Array; import java.util.Arrays; public class Hero { public static void main(String[] args) { int[] a = new int[]{6,4,8,3,9,1,0}; int[] b = new int[5]; //打印数组 System.out.println(Arrays.toString(a)); //排序 Arrays.sort(a); //打印数组元素 System.out.println(Arrays.toString(a)); //查询元素出现的位置 System.out.println("数字8出现的位置:" + Arrays.binarySearch(a, 8)); Arrays.fill(b,5); System.out.println(Arrays.toString(b)); } }