public Gradient(int size, Color[] colors, float[] locations, String leftLabel, String middleLabel, String rightLabel){
        if(colors.length != locations.length || colors.length < 2){
            throw new IllegalArgumentException("colors.length != locations.length || colors.length < 2");
        }
        if(locations[0] != 0 || locations[locations.length-1] != 1){
            throw new IllegalArgumentException("The first location MUST be 0 and the last MUST be 1");
        }
        this.width = size;
        this.colors = colors;
        this.locations = locations;
        String[] labels = new String[]{leftLabel, middleLabel, rightLabel};
        this.update(labels);
    }