package com.ajax;import java.util.*;public class Example10 {public static void main(String[] args){int[] arr={1,3,2,5,4};System.out.println("排序前:");printArray(arr);Arrays.sort(arr);System.out.println("排序后:");printArray(arr);int index=Arrays.binarySearch(arr, 3);System.out.println("查找元素为3的值:"+index);int i=Arrays.binarySearch(arr, 0);System.out.println("没找到的返回值:"+i);int[] a=Arrays.copyOfRange(arr,1,3);System.out.println("数组拷贝:");printArray(a);Arrays.fill(a,0);System.out.println("一个值替换数组所有元素:");String str=Arrays.toString(arr);System.out.println("数组以字符串输出:"+str);}private static void printArray(int[] arr) {for(int i:arr){System.out.print(i);}System.out.println();}}