Java examples for java.lang:int Array
get Max value from an int array
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { int[] array = new int[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 }; System.out.println(getMax(array)); }// www.j av a 2 s .c o m public static int getMax(int[] array) { int max = -1; for (int i = 0; i < array.length; i++) { if (array[i] > max) { max = array[i]; } } return max; } }