Issue
I have an integer that was generated from an android.graphics.Color
The Integer has a value of -16776961
How do I convert this value into a hex string with the format #RRGGBB
Simply put: I would like to output #0000FF from -16776961
Note: I do not want the output to contain an alpha and i have also tried this example without any success
Solution
The mask makes sure you only get RRGGBB, and the %06X gives you zero-padded hex (always 6 chars long):
String hexColor = String.format("#%06X", (0xFFFFFF & intColor));
Answered By - Josh
Answer Checked By - Willingham (JavaFixing Volunteer)