As we know, byte's range is between -128 and 127. I can state a byte variable in bit style which is prefixed with 0b. For example,
byte b = 0b111;
. But how can I state a byte which value is -128 in this style?
Asked
Active
Viewed 33 times
1

H. Soong
- 9
- 3
-
2`byte b = (byte) 0b10000000;` – Andy Turner Jan 07 '19 at 09:52
-
2`b = -0b10000000;` doesn't need a cast. – maio290 Jan 07 '19 at 09:54
-
And not to forget one can use underscores: `-0b1000_0000`. – Joop Eggen Jan 07 '19 at 09:55
-
See also [What is two's complement](https://meta.stackexchange.com/q/66377/286538) – RealSkeptic Jan 07 '19 at 09:55
-
So enthusiastic. Thank you for all :) – H. Soong Jan 07 '19 at 10:01