  import java .util.Vector;
    public class VectorPlay
   {
       public static void main (String [] args)
      {
         Vector myVector;
         int temp;
         Object tempObject, tempObject2;
      
         myVector = new Vector();
      
              // filling the original vector
         for (int i = 0;  i < 25;  i++)
         {
            myVector.add(i);
         }// end for
     
	        // printing the contents of the original vector
         for ( int j = 24;  j > 0; j--)
         {
            temp =(Integer) myVector.elementAt(j);
            System.out.print (temp + " ");
         }// end for
         System.out.println ();
   
      /* 
      //  test of swapping 2 elements
      System.out.println (myVector.elementAt(5));
      System.out.println (myVector.elementAt(10));
      
      tempObject = myVector.get (5);
      myVector.set(5, myVector.get(10));
      myVector.set(10, tempObject);
      
      System.out.println (myVector.elementAt(5));
      System.out.println (myVector.elementAt(10));
      */
      
          // swapping multiple elements 
         for (int k = 5;  k < 10; k++)
         {
         /*  
           //    one way to do the swap
            tempObject = myVector.get(k);
            tempObject2 = myVector.get (20-k);
            myVector.set (k, tempObject2);
            myVector.set(20-k, tempObject);
         */
      
         // another way to swap multiple elements
            tempObject = myVector.get(k);
            myVector.set(k, myVector.get(20-k));
            myVector.set(20-k,tempObject);	
         } // end for   	
     
	  
      // showing the altered vector
         for ( int j = 24;  j > 0; j--)
         {
            temp =(Integer) myVector.elementAt(j);
            System.out.print (temp + " ");
         } // end for
      
      
      } // end main 
   } // end class