Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

working of bitwise ~ operator

Tue Jul 12, 2011 6:00 am

Bitwise operator in java:
Code:
public class B {
   public static void main(String args[]) {
      byte x = 3;
      x = (byte)~x;
      System.out.println(x);
   }
}

=================================
i want to know how the o/p of this code is -4



Re: working of bitwise ~ operator

Tue Jul 12, 2011 2:29 pm

As you may know , negative numbers are store in two's complement form .

11111000 is 2's complement of -4 .

Post a reply
  Related Posts  to : working of bitwise ~ operator
 Bitwise operators     -  
 Bitwise operators in java     -  
 bitwise operators usage in C++     -  
 javap is not working     -  
 SSI.php on other websites, Not working     -  
 video conference is nt working     -  
 jsp include directive not working     -  
 HELP: JAVA not working in TEXTPAD     -  
 Working on hotel class     -  
 ScrollableTable is not working in the firefox     -