package test; public class Recover { public int[] reverse(int[] a) { int[] b = new int[a.length]; int n = a.length - 1; for (int i = 0; i < a.length; i++) { b[n] = a[i]; n--; } return b; } public static void main(String[] args) { Recover t = new Recover(); int[] a = {1, 2, 3, 4, 5}; int[] b = t.reverse(a); for (int i = 0; i < b.length; i++) System.out.print(b[i]+","); } }