public class test { public static void main(String[] a) { int lucky_numbers[] = new int[4]; lucky_numbers[0] = 13; lucky_numbers[1] = 2078; lucky_numbers[2] = 5; lucky_numbers[3] = 44; int r[] = reverse(lucky_numbers); int i; for (i = 0; i < lucky_numbers.length; i++) { System.out.println(lucky_numbers[i] + " "); } for (i = 0; i < lucky_numbers.length; i++) { System.out.println(r[i] + " "); } } public static int[] reverse(int[] a) { int size = a.length; int b[] = new int[size]; int finger = 0; // start copying from a[0] int pen = size - 1; // start assigning to b[size -1] while(pen >= 0) { b[pen] = a[finger]; finger++; // add 1 to finger pen--; // subtract 1 from pen } return b; } }