home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / Counting1.java < prev    next >
Text File  |  1997-07-30  |  568b  |  26 lines

  1. // Copyright(c) 1997 ObjectSpace, Inc.
  2.  
  3. import COM.objectspace.jgl.*;
  4.  
  5. /**
  6.  * Sum the values of a range.
  7.  *
  8.  * @see COM.objectspace.jgl.Counting
  9.  * @version 2.0.2
  10.  * @author ObjectSpace, Inc.
  11.  */
  12.  
  13. public class Counting1
  14.   {
  15.   public static void main( String[] args )
  16.     {
  17.     int intArray[] = { 1, 2, 3, 4, 5 };
  18.     IntIterator begin = IntIterator.begin( intArray );
  19.     IntIterator end = IntIterator.end( intArray );
  20.  
  21.     Number sum = Counting.accumulate( begin, end, new Integer( 0 ) );
  22.  
  23.     System.out.println( "Sum = " + sum );
  24.     }
  25.   }
  26.