Here you can find the source of swap3(String[] a, int x, int y, int z)
Parameter | Description |
---|---|
a | represents the array with the strings for sorting. |
x | position of the first string. |
y | position of the second string. |
z | position of the third string. |
private static void swap3(String[] a, int x, int y, int z)
//package com.java2s; /**// www.j a va 2 s .c o m * Copyright (c) 1997, 2015 by ProSyst Software GmbH and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ public class Main { /** * Auxiliary method for sorting lexicographically the strings. Shuffling strings on positions x, y and z, as the * string * at the position x, goes to the position z, the string at the position y, goes to the position x and the string * at the position z, goes to the position y. * * @param a represents the array with the strings for sorting. * @param x position of the first string. * @param y position of the second string. * @param z position of the third string. */ private static void swap3(String[] a, int x, int y, int z) { String t = a[x]; a[x] = a[y]; a[y] = a[z]; a[z] = t; } }