import java.util.*; public class ReverseArray { static ArrayList reversed = new ArrayList<>(); public static void main (String[] argv) { int[] a = {-1,2,4,-3,2,3}; reverseInt(a); System.out.println (reversed.toString()); } static void reverseInt (int[] a) { for (int i=a.length-1; i>=0; i--) { if (a[i] > 0) { reversed.add(a[i]); } else { break; } } } }