This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes & operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "& operator" Watch "& operator" New topic
Author

& operator

Shiva Mohan
Ranch Hand

Joined: Jan 05, 2006
Posts: 477
System.out.println("---->"+(-7&7)); prints 1
System.out.println(-2&-3); prints -4


but in the bit representation how to get the answer like this.
could anyone please explain in bit representation
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Applied to integral values, the & operator means "bitwise and." For each bit position, it returns 1 if the bits in that position of both operands are 1.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
 
subject: & operator
 
Similar Threads
Scanner class
printing of char value
Please answer,with explanation on how to perform bitwise
Conversion question from Dan's exam
Mock Exam Fundamentals 1 - questions 6,7