### Question:
ColorUtilities { public static String convertToHexString(Color color, int redIndex, int greenIndex, int blueIndex) { int inputVal = color.getRGB(); int outputVal = 0; outputVal |= MathUtil.byteShift(inputVal & 0x00ff0000, 0 - redIndex); outputVal |= MathUtil.byteShift(inputVal & 0x0000ff00, 1 - greenIndex); outputVal |= MathUtil.byteShift(inputVal & 0x000000ff, 2 - blueIndex); return Integer.toHexString(outputVal); } private  ColorUtilities(); static Color blendColors(Color color1, Color color2); static Color brighten(Color input, double factor); static Color convertFromColorString(String color); static Color convertFromHexString(String color, int redIndex, int greenIndex, int blueIndex); static Color convertFromHexString(String color, int redIndex, int greenIndex, int blueIndex, int alphaIndex); static String convertToHexString(Color color, int redIndex, int greenIndex, int blueIndex); static String convertToHexString(Color color, int redIndex, int greenIndex, int blueIndex, int alphaIndex); static String convertToRGBAColorString(Color aColor); static Color darken(Color input, double factor); static Color lighten(Color color); static int getBrightness(Color color); static Color getContrastingColor(Color color); static Color getAlternateColor(Color color, int shift); static boolean isEqual(Color c1, Color c2); static boolean isEqualIgnoreAlpha(Color c1, Color c2); static Color opacitizeColor(Color startingColor, float alpha); static Color opacitizeColor(Color startingColor, int alpha); static final int COLOR_COMPONENT_MAX_VALUE; }### Answer:
@Test public void testConvertToHexStringColorIntIntInt() { Assert.assertEquals("123456", ColorUtilities.convertToHexString(new Color(0x12, 0x34, 0x56, 0x78), 0, 1, 2)); Assert.assertEquals("345678", ColorUtilities.convertToHexString(new Color(0x78, 0x56, 0x34, 0x12), 2, 1, 0)); Assert.assertEquals("ffffff", ColorUtilities.convertToHexString(new Color(0xff, 0xff, 0xff, 0xff), 2, 1, 0)); }
@Test public void testConvertToHexStringColorIntIntIntInt() { Assert.assertEquals("12345678", ColorUtilities.convertToHexString(new Color(0x12, 0x34, 0x56, 0x78), 0, 1, 2, 3)); Assert.assertEquals("12345678", ColorUtilities.convertToHexString(new Color(0x78, 0x56, 0x34, 0x12), 3, 2, 1, 0)); Assert.assertEquals("ffffffff", ColorUtilities.convertToHexString(new Color(0xff, 0xff, 0xff, 0xff), 3, 2, 1, 0)); }