Sort the char array in ascending order using this algorithm.

@param charArray the array of chars that we want to sort
487312
public static void sort(char[] charArray) {
        int index = 0;
        char value = 0;
        
        for(int i = 1; i < charArray.length; i++) {
            index = i;
            value = charArray[index];
            
            while(index > 0 && value < charArray[index - 1]) {
                charArray[index] = charArray[index - 1];
                
                index--;
            }
            
            charArray[index] = value;
        }
    }
538310
public static void sortDescending(double[] doubleArray) {
        int index = 0;
        double value = 0;
        
        for(int i = 1; i < doubleArray.length; i++) {
            index = i;
            value = doubleArray[index];
            
            while(index > 0 && value > doubleArray[index - 1]) {
                doubleArray[index] = doubleArray[index - 1];
                
                index--;
            }
            
            doubleArray[index] = value;
        }
    }
971785
private void addChars(String chars) {
        for (int i = 0; i < chars.length(); i++) {
            int c = chars.codePointAt(i) - min;
            if (values[c] != -1 && values[c] != i) {
                throw new IllegalArgumentException("Duplicate characters in the encoding alphabet");
            }
            values[c] = i;
        }
    }
391083
public static void sortDescending(int[] intArray) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (intArray.length - 1 ); i++) {
                if(intArray[i] < intArray[i + 1]) {
                    TrivialSwap.swap(intArray, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }
857610
public static void sort(char[] charArray) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (charArray.length - 1 ); i++) {
                if(charArray[i] > charArray[i + 1]) {
                    TrivialSwap.swap(charArray, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }
1347541
@Deprecated
    public static <T> void sort(T[] array, int size, Comparator<? super T> comparator)
    {
        if (comparator == null)
        {
            Arrays.sort(array, 0, size); // handles case size < 2 in Java 8 ComparableTimSort
        }
        else
        {
            Arrays.sort(array, 0, size, comparator); // handles case size < 2 in Java 8 TimSort
        }
    }
808810
private static void checkSorted(int[] sorted) {
    for (int i = 0; i < sorted.length-1; i++) {
      if (sorted[i] > sorted[i+1]) {
        throw new RuntimeException("input must be sorted!");
      }
    }
  }
1130712
public static void sortDescending(short[] shortArray) {
        int index = 0;
        short value = 0;
        
        for(int i = 1; i < shortArray.length; i++) {
            index = i;
            value = shortArray[index];
            
            while(index > 0 && value > shortArray[index - 1]) {
                shortArray[index] = shortArray[index - 1];
                
                index--;
            }
            
            shortArray[index] = value;
        }
    }
1241513
private static void sort(int[] a, int n) {
        int inc = 1;
        do {
            inc *= 3;
            inc++;
        } while (inc <= n);

        do {
            inc /= 3;
            for (int i = inc; i < n; i++) {
                int v = a[i];
                int j = i;
                while (a[j - inc] < v) {
                    a[j] = a[j - inc];
                    j -= inc;
                    if (j < inc) {
                        break;
                    }
                }
                a[j] = v;
            }
        } while (inc > 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);
    }
299309
public static <E extends Comparable<E>> void sortDescending(E[] intArray) {
        Quicksort.sort(intArray, 0, intArray.length - 1 , true);
    }
265152
public static char[] addToSortedCharArray(char[] a, char value) {
		
		if(a == null || a.length == 0) {
			return new char[] {value};
		}
		
		int insertionPochar = -java.util.Arrays.binarySearch(a, value) - 1;
		if(insertionPochar < 0) {
			throw new IllegalArgumentException(String.format("Element %d already exists in array", value));
		}
		
		char[] array = new char[a.length + 1];
		if(insertionPochar > 0) {
			System.arraycopy(a, 0, array, 0, insertionPochar);
		}
		array[insertionPochar] = value;
		if(insertionPochar < a.length) {
			System.arraycopy(a, insertionPochar, array, insertionPochar + 1, array.length - insertionPochar - 1);
		}
		
		return array;
	}
1008438
public static char[] copyOf(char[] charArray) {

    	char[] copy = new char[charArray.length];
        System.arraycopy(charArray, 0, copy, 0, charArray.length);
        return copy;
    }
757926
public static <E extends Comparable<E>> void sortDescending(E[] array) {
        while(!Sort.isReverseSorted(array)) {
            FYShuffle.shuffle(array);
        }
    }
37283
public void sort() {
        if (!sorted) {
            sort(heap, Math.min(k,n));
            sorted = true;
        }
    }
511752
protected function sortArray(&$array, $sort_flags = SORT_REGULAR)
    {
        if (! is_array($array)) {
            return;
        }

        ksort($array, $sort_flags);

        foreach ($array as &$arr) {
            $this->sortArray($arr, $sort_flags);
        }
    }
879999
public static void sort(float[] floatArray) {
        int index = 0;
        float value = 0f;
        
        for(int i = 1; i < floatArray.length; i++) {
            index = i;
            value = floatArray[index];
            
            while(index > 0 && value < floatArray[index - 1]) {
                floatArray[index] = floatArray[index - 1];
                
                index--;
            }
            
            floatArray[index] = value;
        }
    }