package com.company; import java.util.*; public class Main { public static void main(String arg[]) { System.out.println("请输入一个数字"); Scanner input =new Scanner(System.in); int a=input.nextInt(); int[] arr={93,5,3,55,57}; // 排序 Arrays.sort(arr); //搜索 int j=Arrays.binarySearch(arr,a); if(j>=0) System.out.printf("%d在数组中",a); else System.out.printf("%d不在数组中",a); } }