aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes confused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "confused" Watch "confused" New topic
Author

confused

zaghal mohd
Ranch Hand

Joined: Jun 27, 2002
Posts: 43
Could you pleas help me to understand this question?

-11 10
why its not 10 -10
thanks in advs......


SCJP,SCWCD,CCNA,CCAI,MCP,MCSA,MCSE<br />working on CCNP+SCBCD
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Here's a program that I wrote this morning for the next version of my mock exam.

It prints true,true.
If you want to calculate the negative of any number in two's compliment format, then invert the bits and add one. The ~ operator inverts the bits.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
zaghal mohd
Ranch Hand

Joined: Jun 27, 2002
Posts: 43
Thanks you dan you are doing well in your mock exams good luck and thanks again
zaghal
Charu Murali
Ranch Hand

Joined: Jul 12, 2002
Posts: 37
You can easily remember the function of ~ operator as " ~X = (-X)-1 ". So in your question ~10 = (-10)-1 = -11.

HTH.
Charu
 
 
subject: confused