Source of Minimum.java


  1: /* 
  2:  * Copyright (c) 1999-2002, Xiaoping Jia.  
  3:  * All Rights Reserved. 
  4:  */
  5: 
  6: /**
  7:  *  This program finds the minimum of an array of integers. 
  8:  */
  9: public class Minimum {
 10: 
 11:   public static void main(String[]args) {
 12:     int a[] = { 75, 34, 80, 11, 95, 34, 53, 81, 33, 13 };
 13:     
 14:     int min = a[0];     
 15:     for (int i = 1; i < a.length; i++) {
 16:       min = Math.min(min, a[i]);
 17:     }
 18:     System.out.println("The minimum value is: " + min);
 19:   }
 20: 
 21: }