Adding this snippet of code to ask: Am I going about this the correct way? I need 4 floats (one representing each of r, g, b, a) and they're supposed to be values between 0 and 1. I'm trying to convert from a hexadecimal integer (eg 0xFFFFFFFF) to the four floats.

You can give it ints, since it'll convert them to floats implicitly, but the problem is, that the expected floats should be in range 0 to 1, but if you give it int's they can only be either 0 or 1, nothing in between.

I don't really know what

c.getRed();

, etc. return, but assuming they return the color component in range 0 to 255, you'd need to divide by

saving us from dividing each time. Also, Java2D's Color object gives the components in that range only as ints. This is certainly not a big performance optimization but certainly helps me since I'm somewhat poor in maths.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org