Loss of precision question

Advertisement
I get an error when trying to do something like this
byte testByte = 0xC9;
Tells me a int was found, and it could possibly loose precision, but This is indeed a byte. Am I doing something wrong?
Thanks for any help.
Matt Bell
Advertisement

Replay

Seems when I do this the highest number I can get to
is 32 anything above that goes to 32 0x20
Anyone know a work around for this?Doubt it. This works perfectly
     byte b = (byte)0xc9;
     System.out.println("b as byte=" + b);
     System.out.println("b as int=" + (0xff & b));
. And produces the following (which is more than 32.)
  b as byte=-55
  b as int=201