With a ten-element initializer list the buggy program will fail about one time in ten (assuming random lists of data.) It might not even be clear when it did fail, because the answer it computes is close to the maximum. With a ten thousand element array (not an uncommon length), the program will fail about one time in ten thousand! Off-by-one errors can be very subtle.
Here is a program that finds the minimum of an array. It is similar in basic style to the maximum-finding program:
class MinAlgorithm { public static void main ( String[] args ) { int[] array = { -20, 19, 1, 5, -1, 27, 19, 5 } ; int min; // initialize the current minimum min = ___________ // scan the array for ( int index=0; index < array.length; index++ ) { _________________ _________________ } System.out.println("The minimum of this array is: " + min ); } }