I am implementing the median-cut algorithm for an image and I have an ArrayList with all my pixels but now I need to sort it based on one color channel. Here is my Pixel class.
public class Pixel implements Comparable<Pixel>{
    public int x,y;
    public double[] colors;
    public Pixel(int x, int y, double[] colors ){
        this.x=x;
        this.y=y;
        this.colors=colors;
    }
    @Override
    public int compareTo(Pixel compareNode) {
        //not sure what to do here
        return 0;
    }
}
The colors array holds the RGB values in [0], [1], and [2] respectively but when I am overriding the compareTo() method I don't know how I would sort by a specific color channel. Am I just going to have to implement my own sorting method?