I want to know how can i convert an integer to byte theoretically. I mean i don't want to use a predefined program but i want just to know how can i implement it. What i know that from -128 to 127 an integer is the same as byte but the problemes is from 128 to 128 to +infinite and from -129 to -infinite. For example given the following code:
Integer a = 140;//10001100 this is his binary conversion
Byte zz = (byte) a.byteValue();
System.out.println(zz);// result is -116
How that conversion works in java? Thanks in advance