jenda0
11/27/2018 - 9:03 AM

Java Method String RGB to Hex Format

Method formats input (3 int representing RGB color) into Hex format (used in HTML). Restrictions should be placed on the integer values to be between values 0 and 255 (inclusive).

public class RGBtoHexColor {
	public static String hexColor(int r, int g , int b) {
		return String.format("#%02X%02X%02X", r, g, b);
	}
}