my hex color string : #ffffff
i want simple way to convert string #rrggbb
to int r;
int g;
int b;
int color = (int)Long.parseLong(myHexColor, 16);
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = (color >> 0) & 0xFF;
this method is true?
thanks.
Edit:______________________________
String colorStr = "#ffffff";
int r= Integer.valueOf( colorStr.substring( 1, 3 ), 16 );
int g= Integer.valueOf( colorStr.substring( 3, 5 ), 16 );
int b= Integer.valueOf( colorStr.substring( 5, 7 ), 16 );