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

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

Description

Used by the quick sort and quick select algorithms.

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w w  w  . j a  v a2s .  c om*/
     * Used by the quick sort and quick select algorithms.
     */
    private static void swap(final int a[], final int i, final int j) {
        final int T;
        T = a[i];
        a[i] = a[j];
        a[j] = T;
    }

    /**
     * Used by the quick sort and quick select algorithms.
     */
    private static void swap(final double a[], final int i, final int j) {
        final double T;
        T = a[i];
        a[i] = a[j];
        a[j] = T;

    }
}

Related

  1. swap(double[] array, int i, int j)
  2. swap(double[] data, int i, int j)
  3. swap(final byte[] array, int firstIndex, int secondIndex)
  4. swap(final byte[] src)
  5. swap(final float[] pVertices, final int pVertexStride, final int pVertexIndexA, final int pVertexIndexB)
  6. swap(final int[] array, final int i, final int j)
  7. swap(final int[] array, final int indexA, final int indexB)
  8. swap(final int[] array, final int pos1, final int pos2)
  9. swap(final Object[] array, final int i, final int j)