Checking the parity of a byte

Hi I have to check for odd parity of a byte. Can any one suggest an efficient way to solve this problem.
[111 byte] By [buddy_boya] at [2007-11-27 8:41:40]
# 1

For a byte, probably the quickest way is to create an array of 256 boolean that indicate for a given byte value whether it is even or odd parity. You only have to initialize the array when the containing class is loaded. At this point speed does not matter.

To fill the array you can use

static int parity(byte value)

{

int v = (value >> 4) ^ value;

v = (v >> 2) ^ v;

v = (v >> 1) ^ v;

return v & 0x1;

}

sabre150a at 2007-7-12 20:40:43 > top of Java-index,Security,Cryptography...
# 2
I really don't understand why people post questions and then ignore answers. From his other posts I know the OP has visited these forums since I posted this so why has he not acknowledge my response. I can only think that his is an ignorant twit.One more to ignore in the future.
sabre150a at 2007-7-12 20:40:43 > top of Java-index,Security,Cryptography...
# 3

Sorry Sir. I was in work tension that was the main reason, but the idea which you gave is very great. I was trying to use that in my program. In future I won't repeat.

> I really don't understand why people post questions

> and then ignore answers. From his other posts I know

> the OP has visited these forums since I posted this

> so why has he not acknowledge my response. I can only

> think that his is an ignorant twit.

>

> One more to ignore in the future.

buddy_boya at 2007-7-12 20:40:43 > top of Java-index,Security,Cryptography...
# 4
Possibly not an ignorant twit.Possibly just an ill-mannered twit.Or possibly an ignorant and ill-mannered twit.My condolences.
ejpa at 2007-7-12 20:40:43 > top of Java-index,Security,Cryptography...