}
final DoubleComparator cmp = new DoubleComparator(x);
Comparator<Integer> mainComparator = new Comparator<Integer>() {
@Override public int compare(Integer o1, Integer o2) {
int res = cmp.cmp(o1, o2);
return !decreasing ? res : -res;
}
};
Arrays.sort(order, 0, oi, mainComparator);
return buildSortResults(x, order, oi, naorder, naLast, naRemoveIndex);