Java Array Swap swap(String a[], int i, int j)

Here you can find the source of swap(String a[], int i, int j)

Description

Private method to swap two elements in the array

License

Open Source License

Parameter

Parameter Description
a an array of <code>String</code>.
i the index of the first element.
j the index of the second element.

Declaration

static private void swap(String a[], int i, int j) 

Method Source Code

//package com.java2s;

public class Main {
    /**//  ww w . j  a  va2 s .c  o  m
     * Private method to swap two elements in the array
     * @param a an array of <code>String</code>.
     * @param i the index of the first element.
     * @param j the index of the second element.
     */
    static private void swap(String a[], int i, int j) {
        String T;
        T = a[i];
        a[i] = a[j];
        a[j] = T;
    }
}

Related

  1. swap(Object[] x, int a, int b)
  2. swap(short x[], int a, int b)
  3. swap(short x[], int[] y, int a, int b)
  4. swap(short x[], T[] a2, int a, int b)
  5. swap(short[] array, int indexA, int indexB)
  6. swap(T[] a, int i1, int i2)
  7. swap(T[] a, int idx1, int idx2)
  8. swap(T[] arr, int a, int b)
  9. swap(T[] arr, int i, int j)