And you know you can use bit manipulation.

You can use an int, eg

00000000000011011101111111100001 and "and" it with another int, eg

10000000000000000000000000000000

That present example will give 0 for all positive numbers, and Integer.MIN_VALUE for any negative numbers, because you will only get the most significant bit (farthest left) coming through if it is "1" in both numbers.

In code that would come out as

If you use & 4, you will get 4 if your number has a "1" in its no 2 bit (ie 3rd from the right) (which is equivalent to myFirstInt % 4 > 3), and 0 if that bit it "0" (or myfirstInt % 4 <= 3).

That is how those numbers work where you use 1 2 4 8 etc. Go to the API specification, look up the Font class, find the fields BOLD or ITALIC, and look up their Constant values. You will find values of 1 2 4 etc. So you can actually add up those values to get something like 3 = bold and italic.

There is a bit

in the Java tutorial about bitwise operators. That might be what you are looking for.

I have got to go now; I hope i have explained it all so you can understand it.

CR

[ May 02, 2006: Message edited by: Campbell Ritchie ]