how does one write a hexadecimal integer literal that is equal to Int.MIN_VALUE
(which is -2147483648
in decimal) in Kotlin?
AFAIK, an Int is 4 bytes...and sometimes it seems like 2's complement is used to represent integers...but I'm not sure. I've tried the following hex literals to help myself understand the system:
-
0xFFFFFFFF
但这是Long
而不是Int
-
0xFFFFFFFF.toInt()
which is -1 -
-0xFFFFFFFF.toInt()
等于1 -
0x7FFFFFFF
是2147483647是Int.MAX_VALUE
-
-0x7FFFFFFF
which is -2147483647 which isInt.MIN_VALUE+1
-
0xFFFFFFF
which is 268435455 in decimal -
0x0FFFFFFF
which is also 268435455 in decimal
But I can't figure out what hexadecimal integer literal can be used to represent Int.MIN_VALUE
.
我希望答案不会让我觉得自己很愚蠢...