package com.lovcoding.day06;

public class TestArr02_Max {

    //查找多个最大值
    public static void main(String[] args) {
        int[] arr = {1,2,5,7,13,67,99,99,23,99};

        //优化
        int max = arr[0];

        //索引
        String index = "";

        //循环
        for (int i = 0; i < arr.length; i++) {
            if ( arr[i] > max ){
                max = arr[i];
                //索引
                index = i+"";
            }else if (max == arr[i]){
                index += " , "+ i;
            }
        }

        System.out.println("最大值"+max);
        System.out.println("索引"+index);

    }
}
