Assigning int to byte in java?

Posted by user303218 on Stack Overflow See other posts from Stack Overflow or by user303218
Published on 2010-03-27T15:08:20Z Indexed on 2010/03/27 15:13 UTC
Read the original article Hit count: 199

Filed under:
int val =233;
byte b = (byte)val;
System.out.println(b);

I have a simple case, like one integer with some value & i want to convert that value & place in the byte type for output. But in this case negative value is coming?

How to successfully place the int value to byte type.

© Stack Overflow or respective owner

Related posts about java