class ColorUtilities {

    public static Color convertFromHexString(String color, int redIndex, int greenIndex, int blueIndex)
        throws NumberFormatException
    {
        if (color == null || color.length() == 0 || color.length() > 6)
        {
            throw new NumberFormatException("For input string: \"" + color + "\"");
        }

        long inputVal = Long.parseLong(color, 16);
        int outputVal = 0;

        outputVal |= 0xff0000 & MathUtil.byteShift(inputVal, redIndex - 1);
        outputVal |= 0xff00 & MathUtil.byteShift(inputVal, greenIndex - 2);
        outputVal |= 0xff & MathUtil.byteShift(inputVal, blueIndex - 3);
        outputVal |= 0xff000000;

        return new Color(outputVal, true);
    }

    private  ColorUtilities();

}