List of utility methods to do Array Sort
Long[] | sort5(Long[] data) sort long[] temp = new long[] { data[0] != null ? data[0] : -1, data[1] != null ? data[1] : -1, data[2] != null ? data[2] : -1, data[3] != null ? data[3] : -1, data[4] != null ? data[4] : -1, }; sort5(temp); return new Long[] { temp[0] < 0 ? null : temp[0], temp[1] < 0 ? null : temp[1], temp[2] < 0 ? null : temp[2], temp[3] < 0 ? null : temp[3], temp[4] < 0 ? null : temp[4], }; |
int | sortableBytesToInt(byte[] encoded, int offset) Decodes an integer value previously written with #intToSortableBytes int x = ((encoded[offset] & 0xFF) << 24) | ((encoded[offset + 1] & 0xFF) << 16) | ((encoded[offset + 2] & 0xFF) << 8) | (encoded[offset + 3] & 0xFF); return x ^ 0x80000000; |
float[] | sortAccording(float[] ary, Integer[] sortOrder) Create a new sorted array according to given sort order float[] res = new float[ary.length]; for (int i = 0; i < ary.length; i++) res[i] = ary[sortOrder[i]]; return res; |
void | sortAccording2(int[] ary, Integer[] sortOrder) Sort given array according given sort order. Integer[] so = sortOrder.clone(); for (int i = 0; i < ary.length; i++) { int tmp = ary[i]; int idx = so[i]; ary[i] = ary[idx]; ary[idx] = tmp; for (int j = i; j < so.length; j++) if (so[j] == i) { ... |
int[] | sortAlleleCount(int[] count) sort Allele Count int[] ids = new int[count.length]; for (int i = 0; i < ids.length; ++i) { ids[i] = i; for (int i = 1; i < ids.length; ++i) { for (int j = 0; j < i; ++j) { if (count[ids[i]] > count[ids[j]]) { int tmp = ids[i]; ... |
String | SortAndConcatenateStringArray(String StrArray[], String Separator) Sort And Concatenate String Array String Result = null; if (StrArray != null && Separator != null) { Arrays.sort(StrArray); StringBuilder Str = new StringBuilder(); for (int i = 0; i < StrArray.length; ++i) { if (i == 0) Str.append(StrArray[i]); else ... |
int[] | sortArray(double[] array) sort Array int length = array.length; double[] arrayClone = new double[length]; System.arraycopy(array, 0, arrayClone, 0, length); int[] indices = new int[length]; for (int i = 0; i < length; i++) { indices[i] = i; for (int i = 0; i < length; i++) { ... |
int[] | sortArray(int[] a) sort Array int[] b = a.clone(); int t = 0; for (int i = 0; i < a.length; i++) { for (int j = i; j < a.length; j++) { if (b[i] > b[j]) { t = b[i]; b[i] = b[j]; b[j] = t; ... |
void | sortArray(int[] array) Basic sort for small arrays of int. 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; ... |
int[] | sortArrayAndReturnIndex(double[] p, String t) sort Array And Return Index int[] ret = new int[p.length]; for (int i = 0; i < ret.length; i++) { ret[i] = i; if (t.equals("desc")) { double temp = p[0]; int q = 0; for (int i = 0; i < p.length; i++) { ... |