Java Array Sort sortArray(int[] array)

Here you can find the source of sortArray(int[] array)

Description

Basic sort for small arrays of int.

License

Open Source License

Declaration

public static void sortArray(int[] array) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   ww w .  j a  v  a 2 s . c om
     * Basic sort for small arrays of int.
     */
    public static void sortArray(int[] array) {

        boolean swapped;

        do {
            swapped = false;

            for (int i = 0; i < array.length - 1; i++) {
                if (array[i] > array[i + 1]) {
                    int temp = array[i + 1];

                    array[i + 1] = array[i];
                    array[i] = temp;
                    swapped = true;
                }
            }
        } while (swapped);
    }
}

Related

  1. sortAccording2(int[] ary, Integer[] sortOrder)
  2. sortAlleleCount(int[] count)
  3. SortAndConcatenateStringArray(String StrArray[], String Separator)
  4. sortArray(double[] array)
  5. sortArray(int[] a)
  6. sortArrayAndReturnIndex(double[] p, String t)
  7. sortByFirst(int[] array1, int[] array2)
  8. sortByIndex(final double[] data, int size)
  9. sortByIndex(int start, int end, int[] indexes, double[] values)