class ColorUtilities {

    public static Color opacitizeColor(Color startingColor, float alpha)
    {
        if (alpha < 0f || alpha > 1f)
        {
            throw new IllegalArgumentException("Alpha [" + alpha + "] cannot be less than 0 or greater than 1.");
        }
        if (startingColor == null || startingColor.getAlpha() == alpha)
        {
            return startingColor;
        }
        return new Color(startingColor.getRGB() & 0xffffff | (int)(alpha * 0xff + 0.5) << 24, true);
    }

    private  ColorUtilities();

}