You prefix a hexadecimal literal with 0x or 0X.
0x999 is a hexadecimal number of type int with three hexadecimal digits.
Here are some more examples of hexadecimal literals:
Hexadecimal literals:0x1AF 0x123U 0xAL 0xcad 0xFF Decimal literals: 431 291U 10L 3245 255
Here are some examples of using hexadecimal to represent color:
#include <iostream> int main()/*from w w w .j a v a 2s. c om*/ { unsigned int color {0x0f0d0eU}; // Unsigned int hexadecimal constant - decimal 986,382 int mask {0XFF00FF00}; // Four bytes specified as FF, 00, FF, 00 unsigned long value {0xdeadLU}; // Unsigned long hexadecimal literal - decimal 57,005 std::cout << "The value of color is " << color << std::endl; std::cout << "The value of mask is " << mask << std::endl; std::cout << "The value of value is " << value << std::endl; }