private int testForCollision(Sprite testSprite) {
   // Check for collision with other
   // sprites
   Sprite sprite;
   for (int cnt = 0; cnt < size(); cnt++) {
     sprite = (Sprite) elementAt(cnt);
     if (sprite == testSprite)
       // don't check self
       continue;
     // Invoke testCollision method
     // of Sprite class to perform
     // the actual test.
     if (testSprite.testCollision(sprite))
       // Return index of colliding
       // sprite
       return cnt;
   } // end for loop
   return -1; // No collision detected
 } // end testForCollision()