Java examples for Language Basics:for
Iterating an Array Using the for Statement [5.0]
for (type variable : array) {
body-code
}
public class Main { // Returns the smallest integer in the supplied array public int getMin(int[] ints) { int min = Integer.MAX_VALUE; for (int num : ints) { if (num < min) { min = num;//from w ww . ja va 2s . c om } } return min; } }