Convert int RGB to Byte

Hallo,

I have a byte array where colors are stored: 1 field R, 2 field G, 3 field B, 4 field R, 5 field G, 6 field B and so on.

The byte range goes from -128 to 127 (of course).

Now I want to store RGB values (range from 0 to 255) into this byte array.

I tried something like bytearray[0] = (byte)mycolor.getRed()/2 but with this method the color gets much darker.

Is there an algorithm to solve this problem?

Thank you,

[463 byte] By [len00xa] at [2007-9-29 20:25:22]
# 1
ok. I already solved the problem.
len00xa at 2007-7-16 0:37:23 > top of Java-index,Other Topics,Algorithms...