Linked Questions

16 votes
7 answers
2k views

I know the working of XOR, Console.WriteLine(1^1); // returns 0 results to 00000001 00000001 -------- 00000000 but how does this return 2? Console.WriteLine(-(-1^1)); // returns 2
Toshi's user avatar
  • 2,628
-2 votes
3 answers
5k views

I was experimenting with bit operations in java I tried setting bit index by index and this is what I have got. Started setting with 0 th bit in the integer 0 to 31st bit (as int has got 32 bits ...
Athul Muralidharan's user avatar
-1 votes
1 answer
7k views

Java Datatypes like int,short,byte are two's complement integers ,as they menioned it in here . what information does it give when someone says that in java , int ,short or byte are two's complement ...
M Alok's user avatar
  • 1,143
1 vote
3 answers
2k views

I see in the JDK that Integer.MIN_VALUE is 0x80000000. Considering that the original is 0x80000000, then the opposite is 0x8fffffff, and finally the complement is 0x8fffffff + (-1) = -2^32? So whether ...
zhongwei's user avatar
  • 335
-1 votes
2 answers
3k views

If Java's long primitive data type is a 64-bit signed integer, then why do the Java docs state that the static long maximum value is 2^63-1? Is there a larger reason that affects other primitive data ...
Alejandro's user avatar
  • 647
5 votes
1 answer
2k views

I'm trying to understand why INT_MIN is equal to -2^31 - 1 and not just -2^31. My understanding is that an int is 4 bytes = 32 bits. Of these 32 bits, I assume 1 bit is used for the +/- sign, leaving ...
rahimftd's user avatar
  • 101
0 votes
1 answer
5k views

What is a 2's complement of 2's complement. I know about 2's complement of a positive integer but what about negative integer. What is a 2's complement of a negative integer eg: what is 2's complement ...
Sam's user avatar
  • 764
0 votes
1 answer
780 views

I read that in java, negative integers are obtained by taking 2's complement of a positive integer. In short, it also means that the higher order bit is being set to 1 in order to convert a positive ...
Anubhav Pandey's user avatar
1 vote
5 answers
678 views

I'm confused about the negation operation after doing the bit shift. For example: -(1<<7) is 0xffffff80 But why are the most significant bits filled with 1? I'm confused about what the ...
Mike's user avatar
  • 1,907
0 votes
1 answer
518 views

I'm wondering why java int type (32 bit signed) has valid value in range -2,147,483,648 to 2,147,483,647 but not in (-2,147,483,648 to 2,147,483,648)?
logbasex's user avatar
  • 2,498
2 votes
2 answers
536 views

My goal is to understand the two's complement. 10000111 in signed integer equals to -121. However, if you bitwise AND it with 0xFF in hexadecimal or 11111111 in decimal, it will equals to 135. In my ...
Jason Rich Darmawan's user avatar
1 vote
3 answers
395 views

I was testing out the bitwise not operator in Java. I printed out the result of ~1 in binary, and it returned "11111111111111111111111111111110" which apparently evaluates to -2. I know that you ...
Jeremiah John's user avatar
1 vote
0 answers
374 views

why range is not equally divided it can be -127 to 128. and if we consider range -128 to 127 then -128 can not be represented in 8 bits. -128 in binary 1100000000 first bit is for sign bit.
Sanwar lal's user avatar
-2 votes
1 answer
137 views

I have a question in my programming class, it is: What is the value of ~12 and the answer is -13. I don't understand why? I convert 13 base 10 to binary, which is 1100, than I switched all the 1 for 0 ...
minos01's user avatar
  • 19
-3 votes
1 answer
171 views

I have a question in java about integer overflow. When I search max integer and surfed integer for that binary, I got this "0111 1111 1111 1111 1111 1111 1111 1111" and also when I use the ...
Tholkappiar's user avatar

15 30 50 per page
1
2 3 4 5
9