// Find the minimum value and corresponding index // of the values in an array. public class FindMin { public static void main(String[ ] argv) { int a[ ] = { 67, 23, 57, 93, 91, 45, 29 }; int min, minindex; // Set initial values of min and minindex. // These would be the values if the array // were of length 1. min = a[0]; minindex = 0; // If new value is less than the min, // update values. for(int i = 1; i <= a.length - 1; i++) if (a[i] < min) { min = a[i]; minindex = i; } // Print min value and corresponding index. System.out.println("The min value is " + min + "."); System.out.println("Index is " + minindex + "."); } }