I am using following snippet to build a 32 bit integer to use with setRGB of BufferedImage
(bit-or (bit-shift-left a 24)
(bit-or (bit-shift-left r 16)
(bit-or (bit-shift-left g 8) b)))
after writing colors reading them back reveals wrong colors is there a fault in my logic?
Are you sure you have a problem? I tried generating a few values based on your method and a functionally equivalent alternative:
and got identical values.
I got the same numbers on my pocket caculator.
Are there specific arguments that you have seen to produce incorrect results?
Perhaps it isn’t a fault in this logic but in writing/reading the values to the BufferedImage.