/** * Created by xabcd on 2019/2/16. */ public class java_largest { public static void main(String args[]) { int arr[] = {23,56,88,92,45,12,11,15}; int max = largest(arr); System.out.println("最大的数字是"+max); } public static int largest(int arr[]) { int tem=0; for (int i = 0;i<arr.length;i++){ if (arr[i]>tem){ tem = arr[i]; } } return tem; } }