Java Array Sort sortInPlace(final double[] v, final int i, final int j)

Here you can find the source of sortInPlace(final double[] v, final int i, final int j)

Description

sort In Place

License

Open Source License

Declaration

private static void sortInPlace(final double[] v, final int i, final int j) 

Method Source Code

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

public class Main {
    private static void sortInPlace(final double[] v, final int i, final int j) {
        if (v[i] > v[j]) {
            final double tmp = v[i];
            v[i] = v[j];//from  www.  j a  v  a2 s  .  c  om
            v[j] = tmp;
        }
    }

    private static void sortInPlace(final int[] v, final int i, final int j) {
        if (v[i] > v[j]) {
            final int tmp = v[i];
            v[i] = v[j];
            v[j] = tmp;
        }
    }
}

Related

  1. sortIndex(double[] doubleArray)
  2. sortIndexes(final T[] array)
  3. sortIndexesDescending(final double[] in)
  4. sortindices(double[] x)
  5. sortIndices(float[] main)
  6. sortInPlace(int[] array)
  7. sortInterval(byte[] x, int start, int end)
  8. sortKeyValuePairs(long[] keys, double[] values, int startInd, int endInd)
  9. sortLeftRightAndCenter(double[] array, int[] index, int l, int r)