I try to sort a 2D double array (double[][]) on the first value. example: {1.0226342823592962,0.0}, {1.0395582845873155,1.0} starting with the biggest value. This is the code I use (java generated half of it)
java.util.Arrays.sort(indexMatrix, new java.util.Comparator<double[]>() {
@Override
public int compare(double[] o1, double[] o2) {
// TODO Auto-generated method stub
return 0;
}
});
However my 'indexMatrix' is not changed after. I think it has something to do with public int compare, because the values are so close to each other, if you cast them to int they will all be 1 and cannot be sorted. Or is it something else?