import java.util.Arrays;
 
public class Main {
    
	public static void reverse(Object [] a){
    		for(int i = 0; i < a.length / 2; i++){
        		Object temp = a[i]; // swap using temporary storage
        		a[i] = a[a.length - i - 1];
        		a[a.length - i - 1] = temp;
		}
	}
   
	public static void main(String[] args) {
		String [] a = new String[]{"first", "second", "third", "fourth"}; 
		String [] b = new String[]{"first", "second", "third"}; 

		reverse(a);
		reverse(b);

		System.out.println(Arrays.toString(a));
		System.out.println(Arrays.toString(b));
	}
}