Here you can find the source of swap(int[] inArray, int index1, int index2)
Parameter | Description |
---|---|
inArray | a parameter |
index1 | a parameter |
index2 | a parameter |
public static void swap(int[] inArray, int index1, int index2)
//package com.java2s; /* ****************************************************************************** * /*from ww w. j av a 2 s.co m*/ * This file is part of JMH * * License: * EPL: http://www.eclipse.org/legal/epl-v10.html * LGPL 3.0: http://www.gnu.org/licenses/lgpl-3.0-standalone.html * See the LICENSE file in the project's top-level directory for details. * * **************************************************************************** */ public class Main { /** * Swaps the positions index1 and index2 of inArray. * * @param inArray * @param index1 * @param index2 */ public static void swap(int[] inArray, int index1, int index2) { int temp = inArray[index1]; inArray[index1] = inArray[index2]; inArray[index2] = temp; } }