Java Array Sort sortPopup(Integer[] integers)

Here you can find the source of sortPopup(Integer[] integers)

Description

popup sorting (assent)

License

Apache License

Parameter

Parameter Description
integers a parameter

Declaration

public static Integer[] sortPopup(Integer[] integers) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*from   w  w  w  .ja va2  s  .c om*/
     * popup sorting (assent)
     * @param integers
     * @return
     */
    public static Integer[] sortPopup(Integer[] integers) {
        Integer[] sortedIntegers = new Integer[integers.length];
        System.arraycopy(integers, 0, sortedIntegers, 0, integers.length);

        int arrayLength = sortedIntegers.length;
        for (int i = 0; i < arrayLength - 1; i++) {
            int a = sortedIntegers[i];
            for (int j = i + 1; j < arrayLength; j++) {
                int b = sortedIntegers[j];
                if (a > b) {
                    sortedIntegers[i] = b;
                    sortedIntegers[j] = a;
                    a = b;
                }
            }
        }

        return sortedIntegers;
    }
}

Related

  1. sortNames(String[] names)
  2. sortNullElements(Object[] array)
  3. sortPerm(final int[] w)
  4. sortPermutation(final int[] A)
  5. sortPixels(double[] data, int numPixel)
  6. sortRetain(long[] a)
  7. sortReverseOrder(String[] strings)
  8. sortStringArray(String array[], boolean inplace)
  9. sortStringArray(String[] array)