home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-30 | 633 b | 27 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 Counting4
- {
- public static void main( String[] args )
- {
- Array array = new Array();
- for ( int i = 0; i < 10; ++i )
- array.add( new Integer( i * i ) );
- System.out.println( array );
-
- // note that this writes over the original array
- Counting.adjacentDifference( array, array.start() );
- System.out.println( array );
- }
- }
-