【java】java.util.Arrays类常用方法
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package Arrays类; 2 3 import java.util.Arrays; 4 5 public class TestArrays { 6 public static void main(String[] args) { 7 int[] a={1,9,3,5,7,8,2,6,0,4}; 8 System.out.println(Arrays.binarySearch(a, 9));//-11 9 Arrays.sort(a); 10 System.out.println(Arrays.binarySearch(a, 9));//9 11 int[] b=new int[9]; 12 Arrays.fill(b, 8); 13 System.out.println(Arrays.toString(b));//[8, 8, 8, 8, 8, 8, 8, 8, 8] 14 } 15 }