Notice: A non well formed numeric value encountered in /home/yeezil/javver.com/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/yeezil/javver.com/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
A quick recipe, converting an int or long like 65 to a string like 000041. It’s useful for converting integer RGB colors to the common #FFBBCC kind of web encoded colors.
1 2 3 |
int number = 65; String hexString = String.format("%06X", number); System.out.println(hexString); |
:>