Here you can find the source of sort5(Long[] data)
public static Long[] sort5(Long[] data)
//package com.java2s; //License from project: Open Source License public class Main { public static Long[] sort5(Long[] data) { 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);//from ww w .ja v a 2 s . c om 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], }; } public static void sort5(long[] data) { // from http://stackoverflow.com/questions/32172144/fastest-way-to-sort-10-numbers-numbers-are-32-bit long swap; if (data[0] > data[3]) { swap = data[0]; data[0] = data[3]; data[3] = swap; } if (data[1] > data[4]) { swap = data[1]; data[1] = data[4]; data[4] = swap; } if (data[0] > data[2]) { swap = data[0]; data[0] = data[2]; data[2] = swap; } if (data[0] > data[1]) { swap = data[0]; data[0] = data[1]; data[1] = swap; } if (data[2] > data[4]) { swap = data[2]; data[2] = data[4]; data[4] = swap; } if (data[1] > data[2]) { swap = data[1]; data[1] = data[2]; data[2] = swap; } if (data[1] > data[3]) { swap = data[1]; data[1] = data[3]; data[3] = swap; } if (data[2] > data[3]) { swap = data[2]; data[2] = data[3]; data[3] = swap; } if (data[3] > data[4]) { swap = data[3]; data[3] = data[4]; data[4] = swap; } } }