home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-30 | 748 b | 30 lines |
- // Copyright(c) 1997 ObjectSpace, Inc.
-
- import COM.objectspace.jgl.*;
-
- /**
- * Calculate and sum the difference between adjacent pairs of values.
- *
- * @see COM.objectspace.jgl.Counting
- * @version 2.0.2
- * @author ObjectSpace, Inc.
- */
-
- public class Counting3
- {
- public static void main( String[] args )
- {
- // create sample array
- int intArray[] = { 1, 2, 4, 8, 16 };
- IntIterator begin = IntIterator.begin( intArray );
- IntIterator end = IntIterator.end( intArray );
- Printing.println( begin, end );
-
- // make sure destination hase enough space allocated
- Array array = new Array( 5 );
-
- Counting.adjacentDifference( begin, end, array.start() );
- Printing.println( array );
- }
- }
-