J
J
Jake Taylor2021-05-01 21:05:31
Java
Jake Taylor, 2021-05-01 21:05:31

What does the phrase "two's complement integer" mean in Java's definition of primitive types?

We open the official Oracle documentation about primitive types and in the definitions of primitive types we meet the phrase signed two's complement integer. , for example here:

byte: The byte data type is an 8-bit signed two's complement integer. 

int: By default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1.


What does this phrase signed two's complement integer mean. ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Developer, 2021-05-01
@n199a

https://en.wikipedia.org/wiki/%D0%94%D0%BE%D0%BF%D...
In particular, for byte this means that numbers take values ​​from -128 to 127, and not from 0 to 255 as it might seem.
Same for signed integer int

O
Orkhan, 2021-05-01
Hasanly @azerphoenix

Good afternoon.
Mmm... well, you can google it, right?
https://en.wikipedia.org/wiki/Two%27s_complement
https://ru.wikipedia.org/wiki/%D0%94%D0%BE%D0%BF%D...
I think in Russian, yes and written in English quite informatively.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question