home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
Counting4.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
684b
|
27 lines
// Copyright(c) 1997 ObjectSpace, Inc.
import com.objectspace.jgl.*;
import com.objectspace.jgl.algorithms.*;
/**
* Calculate and sum the difference between adjacent pairs of values.
*
* @see com.objectspace.jgl.algorithms.Counting
* @version 3.0.0
* @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 );
}
}