Here you can find the source of Sort(float cais[])
public static int[] Sort(float cais[])
//package com.java2s; //License from project: LGPL public class Main { public static int[] Sort(float cais[]) { int res[] = new int[cais.length]; for (int i = 0; i < res.length; i++) res[i] = i;//w w w. j a v a2 s . c o m int i, j, k, inc, n = cais.length; float v; inc = 1; do { inc *= 3; inc++; } while (inc <= n); do { inc /= 3; for (i = inc + 1; i <= n; i++) { v = cais[res[i - 1]]; j = i; k = res[i - 1]; while (cais[res[j - inc - 1]] < v) { //cais[j]=cais[j-inc]; res[j - 1] = res[j - inc - 1]; j -= inc; if (j <= inc) break; } //cais[j]=v; res[j - 1] = k; } } while (inc > 0); return res; } }