I am confused why maximum value of a byte is equal to 127. From my understanding, the the maximum of a byte (8 bits) should be 2 to the power of 0 plus 2 to the power of 1 to 2 to the power of 7?
Asked
Active
Viewed 54 times
0
-
7`byte` is signed in Java. -128 to +127. – shmosel Apr 18 '16 at 19:43
-
1See https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html – azurefrog Apr 18 '16 at 19:43
-
Alright, it is signed! That's why! – user6119494 Apr 18 '16 at 19:45
-
All the primitive types are signed except `boolean` and `char` – Peter Lawrey Apr 19 '16 at 02:12