This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Whizlabs question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Whizlabs question" Watch "Whizlabs question" New topic

Whizlabs question

Latha Kota
Ranch Hand

Joined: Mar 13, 2003
Posts: 35
HI all, I found this question from Whizlabs software, can anybody explain me the answer. I dont have a clear concept of shift operators.
The answer is 2147483647
Thanks in advance
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
-1 is the following number in binary:
1111 1111 1111 1111 1111 1111 1111 1111
Shift to the right by one bit to get:
0111 1111 1111 1111 1111 1111 1111 1111 -> a 1 falls off the end here.

The zero on the left appears because we are using the >>> operator (compare with what the >> operator does)
What's the decimal equivalent of the result?

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: Whizlabs question
It's not a secret anymore!