// Textbook fragment 05.08 /** A nonrecursive generic method for reversing an array */ public static void reverse(E[] a) { Stack S = new ArrayStack(a.length); for (int i=0; i < a.length; i++) S.push(a[i]); for (int i=0; i < a.length; i++) a[i] = S.pop(); }