Here you can find the source of reverseUseList(int[] values)
public static void reverseUseList(int[] values)
//package com.java2s; /**/*from w w w .j a v a2 s.c o m*/ * HashMap?????????????????????????new?????????????????????????? * ???????? * code by guava-libraries.(Apache License 2.0) * https://code.google.com/p/guava-libraries/ * * @return HashMap???????????????????????? */ import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static void reverseUseList(int[] values) { List<Integer> list = new ArrayList<Integer>(); for (int object : values) { list.add(object); } Collections.reverse(list); Integer[] integers = list.toArray(new Integer[0]); int i = 0; for (int value : integers) { values[i] = value; i++; } } public static void reverse(int[] values) { for (int i = 0; i < values.length / 2; i++) { int tmp = values[values.length - i - 1]; values[values.length - i - 1] = values[i]; values[i] = tmp; } } public static String reverse(String str) { char[] charArray = str.toCharArray(); char[] resultChar = new char[charArray.length]; for (int i = 0; i < charArray.length; i++) { resultChar[i] = charArray[charArray.length - i - 1]; } String result = new String(resultChar); return result; } public static char[] toCharArray(String str) { char[] result = str.toCharArray(); return result; } }