problème de conversion d'un entier en color
Bonjour,
C'est la première fois que je trvaille avec Color, et là j'essaye de convertir un entier représentant une couleur RGB, en code hexa
voici ma fonction
Code:
1 2 3 4 5 6 7 8 9
| public String convertcolor(int intColor)
Color couleur=new Color(intColor);
String hex = Integer.toHexString(couleur.getRGB() & 0xffffff);
if (hex.length() < 6)
hex = "0" + hex;
hex = "#" + hex;
return hex; |
par exemple pour l'entier 255009033 ici rgb correspond à (r=255,g=009,b=033) ce code correspond à #FF0921 en héxa, alors que ma fonction renvoie #332109
merci pour votre aide