Array array1 = new Array();
for ( int i = 0; i < 5; i++ )
array1.add( new Integer( i ) );
for ( int i = 0; i < array1.size(); i++ )
{
Array array2 = new Array( array1 );
ArrayIterator p = array2.begin();
p.advance( i );
Rotating.rotate( array2.begin(), p, array2.end() );
System.out.println( "Rotate around index " + i + ", " + array1 + " -> " + array2 );
}
Deque d = new Deque();
ArrayIterator q = array1.begin();
q.advance( 1 );
Rotating.rotateCopy( array1.begin(), q, array1.end(), new InsertIterator( d ) );
System.out.println( "Rotate around index 2, " + array1 + " -> " + d );