Here you can find the source of reverse(T[] array)
@SuppressWarnings("unchecked") public static <T> T[] reverse(T[] array)
//package com.java2s; /**/*from w w w. ja v a 2 s . com*/ * Aptana Studio * Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions). * Please see the license.html included with this distribution for details. * Any modifications to this file must keep this entire header intact. */ import java.util.Arrays; import java.util.Collections; import java.util.List; public class Main { @SuppressWarnings("unchecked") public static <T> T[] reverse(T[] array) { List<T> list = Arrays.asList(array); Collections.reverse(list); return (T[]) list.toArray(); } }