Here you can find the source of swapArrayValues(int i1, int i2, int[] indices)
Parameter | Description |
---|---|
i1 | First index |
i2 | Second index |
indices | Array of indices to swap |
private static void swapArrayValues(int i1, int i2, int[] indices)
//package com.java2s; /*/* w w w .j av a 2 s. c o m*/ * File: CollectionUtil.java * Authors: Justin Basilico * Company: Sandia National Laboratories * Project: Cognitive Foundry * * Copyright March 25, 2008, Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the U.S. Government. Export * of this program may require a license from the United States Government. * See CopyrightHistory.txt for complete details. * */ public class Main { /** * Swaps the two indexed values in the indices array. * * @param i1 First index * @param i2 Second index * @param indices Array of indices to swap */ private static void swapArrayValues(int i1, int i2, int[] indices) { int temp = indices[i1]; indices[i1] = indices[i2]; indices[i2] = temp; } }