Convert a RGB Color Value to a Hexadecimal String
java, swing
Solution
You can use
String hex = String.format("#%02x%02x%02x", r, g, b);
Use capital X's if you want your resulting hex-digits to be capitalized (`#FFFFFF` vs. `#ffffff`).
Problem
In my Java application, I was able to get the `Color` of a `JButton` in terms of red, green and blue; I have stored these values in three `int`s. How do I convert those RGB values into a `String` containing the equivalent hexadecimal representation? Such as `#0033fA`