private int getRgb(int rank)
    {
        rank = rank < 0 ? 0 : rank;

        Integer rgb;
        int red = 0;
        int green = 0;
        int blue = 0;
        String rgbString;
        String redString;
        String greenString;
        String blueString;

        if (rank <= 25)
        {
            red = 255;
            green = (int) (10.2 * rank);
            blue = 0;
        }
        else if (rank <= 50)
        {
            red = (int) (255 - (10.2 * (rank - 25)));
            green = 255;
            blue = 0;
        }
        else if (rank <= 75)
        {
            red = 0;
            green = 255;
            blue = (int) (10.2 * (rank - 50));
        }
        else if (rank <= 100)
        {
            red = 0;
            green = (int) (255 - (10.2 * (rank - 75)));
            blue = 255;
        }

        redString = String.format("%x", red);
        blueString = String.format("%x", green);
        greenString = String.format("%x", blue);

        redString = redString.length() == 1 ? "0" + redString : redString;
        blueString = blueString.length() == 1 ? "0" + blueString : blueString;
        greenString = greenString.length() == 1 ? "0" + greenString
                                               : greenString;

        rgbString = redString + greenString + blueString;
        rgb = Integer.parseInt(rgbString, 16);
        return rgb;
    }