RGB to HEX

i have 3 numbers ( r, g , b ) …
how do i get a number which is HEX equivalent ???
color : Number = r<<16 | g<<8 | b
is giving me something, which i am not sure if it is HEx