package com.lovcoding.day06;

public class TestArr01 {

    //查找多个最大值
    public static void main(String[] args) {
        int[] arr = {1,2,5,7,13,67,99,99,23,99};
        //出现三个最大值 99
        //返回索引
        //第一步 找出最大值
        int max = arr[0];

        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]){
                max = arr[i];
            }
        }
        System.out.println(max);
        //第二步 查找索引
        //依次比较
        String index ="[";
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == max){
                index += i +",";
            }
        }
        index+="]";
        System.out.println(index);
    }
}
