选择排序

@param arrays 数组
339217
public static void selectSort(int[] arrays) {
        for (int i = 0; i < arrays.length; i++) {
            int lowIndex = i;
            for (int j = i + 1; j < arrays.length; j++) {
                if (arrays[j] < arrays[lowIndex]) {
                    lowIndex = j;
                }
            }
            if (lowIndex != i) {
                switchNumber(arrays, i, lowIndex);
            }
        }
    }
554239
public void setRaidArrays(java.util.Collection<RaidArray> raidArrays) {
        if (raidArrays == null) {
            this.raidArrays = null;
            return;
        }

        this.raidArrays = new com.amazonaws.internal.SdkInternalList<RaidArray>(raidArrays);
    }
715967
public static <T> void reverse(final T array) {

        if (ArrayUtils.isArray(array)) {
            int mlength = Array.getLength(array) - 1;
            Object temp = null;
            for (int i = 0, j = mlength; i < mlength; i++, j--) {
                Object arg0 = Array.get(array, i);
                Object arg1 = Array.get(array, j);
                temp = arg0;
                Array.set(array, i, arg1);
                Array.set(array, j, temp);
            }
        }
    }
763232
public static void atIndex( final int[] array, int index, int value ) {
        final int i = calculateIndex( array, index );

        array[ i ] = value;
    }
1333138
public static void bubbleSort(int[] arrays) {
        for (int i = 0; i < arrays.length - 1; i++) {
            for (int j = 0; j < arrays.length - 1 - i; j++) {
                if (arrays[j] > arrays[j + 1]) {
                    switchNumber(arrays, j, j + 1);
                }
            }
        }
    }
1073464
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);
    }
1092555
protected static void checkNotNull (Object[] array)
    {
        checkNotNull((Object)array);
        for (Object o : array) {
            checkNotNull(o);
        }
    }
443354
public static void shellSort(int[] arrays) {
        int h = 1;
        while (h <= arrays.length / ValueConsts.THREE_INT) {
            h = h * 3 + 1;
        }
        while (h > 0) {
            for (int i = h; i < arrays.length; i += h) {
                if (arrays[i] < arrays[i - h]) {
                    int tmp = arrays[i];
                    int j = i - h;
                    while (j >= 0 && arrays[j] > tmp) {
                        arrays[j + h] = arrays[j];
                        j -= h;
                    }
                    arrays[j + h] = tmp;
                }
            }
            h = (h - 1) / 3;
        }
    }
325657
public static String[] unique(String[] arrays) {
        List<String> list = new ArrayList<>(arrays.length);
        for (String arr : arrays) {
            if (!list.contains(arr)) {
                list.add(arr);
            }
        }
        String[] res = new String[list.size()];
        int i = 0;
        for (String arr : list) {
            res[i++] = arr;
        }
        return res;
    }
886340
public void setValues(java.util.Collection<String> values) {
        if (values == null) {
            this.values = null;
            return;
        }

        this.values = new java.util.ArrayList<String>(values);
    }
1231976
public static List<String> reverse(final String[] array) {
        
        ArgUtils.notNull(array, "array");
        if(array.length == 0) {
            return new ArrayList<String>();
        }
        
        final List<String> list = Arrays.asList(array);
        Collections.sort(list, new Comparator<String>() {
            
            @Override
            public int compare(final String str1, final String str2) {
                
                int len1 = str1.length();
                int len2 = str2.length();
                
                if(len1 != len2) {
                    // 逆順
                    return Integer.compare(len1, len2) * -1;
                } else {
                    // 逆順
                    return str1.compareTo(str2) * 1;
                }
            }
        });
        
        return list;
    }
983306
public static void displayArray(int[] array) {
        String line = "";
        for (int f = 0; f < array.length; f++) {
            line += array[f] + " | ";
        }
        logger.debug(line);
    }
864853
public static int[] ConcatenateInt(List<int[]> arrays) {

        int size = 0;
        for (int i = 0; i < arrays.size(); i++) {
            size += arrays.get(i).length;
        }

        int[] all = new int[size];
        int idx = 0;

        for (int i = 0; i < arrays.size(); i++) {
            int[] v = arrays.get(i);
            for (int j = 0; j < v.length; j++) {
                all[idx++] = v[i];
            }
        }

        return all;
    }
1185414
public static void fillArray(Object[] array, Object value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }
1282204
public static byte[] concat(final byte[]... arrays) {
    int len = 0;
    for (final byte[] arr : arrays) {
      len += arr.length;
    }

    final byte[] result = new byte[len];
    int pos = 0;
    for (final byte[] arr : arrays) {
      System.arraycopy(arr, 0, result, pos, arr.length);
      pos += arr.length;
    }
    return result;
  }
129190
public static byte[] cat(byte[]... arrays) {
        int size = 0;
        for(byte[] a: arrays)
            if(a != null)
                size += a.length;
        byte[] cated = new byte[size];
        int pos = 0;
        for(byte[] a: arrays) {
            if(a != null) {
                System.arraycopy(a, 0, cated, pos, a.length);
                pos += a.length;
            }
        }

        return cated;
    }
1329187
protected void fillArray(final short[] array) {
    int pos = 0;
    int base = 0;
    for (int k = 0; k < bitmap.length; ++k) {
      long bitset = bitmap[k];
      while (bitset != 0) {
        array[pos++] = (short) (base + numberOfTrailingZeros(bitset));
        bitset &= (bitset - 1);
      }
      base += 64;
    }
  }