JAVAケース6(配列取得最値)

554 ワード

配列取得最大値(配列内の最大値最小値を取得)
package com.igeek_06;

/**  
 * @ClassName: ArrayTest2  
 * @Description:       (            )
 * @date 2017 10 12    6:14:30    
 * Company www.igeekhome.com
 *    
 *   :      (            )
 */
public class ArrayTest2 {
	public static void main(String[] args) {
		//    
		int[] arr = {12,98,45,73,60};
		
		//     
		int max = arr[0];
		
		//    ,    0       ,    
		for(int x=1; x max) {
				max = arr[x];
			}
		}
		System.out.println("        :"+max);
	}
}