How to convert a color integer to a hex String in Android?
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));
Try Integer.toHexString()
Source: In Java, how do I convert a byte array to a string of hex digits while keeping leading zeros?