package com.lovcoding.day05.arr;

import java.util.Random;

public class Test04ArrSuanFa02 {

    public static void main(String[] args) {
        //求最大值
        int[] arr = {10,23,34,56,61,23,102,208};
        //索引
        int index = 0;
        //假设
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            //比较
            if (arr[i] > max){
                //如果大于max 从新赋值
                max = arr[i];
                //记录索引
                index = i;
            }
        }
        System.out.println("最大值是:"+max+"：索引是："+index); //double

        //产生随机数
        int v =(int) (Math.random() * 100);  //Math.random() [0-1) 0-0.9999

        System.out.println(v);
    }
}
