@Test
public void testSort() {

    double[][] features = new double[][]{{4, 1}, {3, 3}, {2, 0}, {1, 4}, {0, 2}};
    double[] labels = new double[]{0, 1, 2, 3, 4};
    DecisionTreeData data = new DecisionTreeData(features, labels, useIdx);
    data.sort(0);
    assertArrayEquals(new double[][]{{0, 2}, {1, 4}, {2, 0}, {3, 3}, {4, 1}}, features);
    assertArrayEquals(new double[]{4, 3, 2, 1, 0}, labels, 1e-10);
    data.sort(1);
    assertArrayEquals(new double[][]{{2, 0}, {4, 1}, {0, 2}, {3, 3}, {1, 4}}, features);
    assertArrayEquals(new double[]{2, 0, 4, 1, 3}, labels, 1e-10);
}