Solaris byte[] issue
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tyler_Bye
Posted On:   Wednesday, March 21, 2001 07:29 AM

I know that Java has no unsigned types, but I'm seeing a very strange behavior in one of my applets when using a byte array. The idea is to have a byte array defined as something such as 1001 0111 I then instantiate another byte array to use as a mask... 1000 0000 Now I know some of you are thinking, no problem... use the unsigned shift to iterate the mask... but that doesn't work... on Sparc solaris. Whenever I instantiate the byte array as this... 1111 1111 Windows says -128 Solaris says 63... or basically doesn't recognize the signed bit so I end up with.... 0011 1111 ... whenever the first bit (signed bit) is set. It always revert   More>>

I know that Java has no unsigned types, but I'm seeing a very strange behavior in one of my applets when using a byte array.

The idea is to have a byte array defined as something such as

1001 0111

I then instantiate another byte array to use as a mask...

1000 0000

Now I know some of you are thinking, no problem... use the unsigned shift to iterate the mask... but that doesn't work... on Sparc solaris. Whenever I instantiate the byte array as this...

1111 1111

Windows says -128

Solaris says 63... or basically doesn't recognize the signed bit so I end up with....

0011 1111

... whenever the first bit (signed bit) is set. It always reverts to 63??

Any suggestions or clues to why Solaris Sparcs would behave this way? Is there a better data structure I could cast my byte array to and then iterate through? I'm just disappointed because Windows behaves correctly.

   <<Less
About | Sitemap | Contact