This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

bit shifting example  RSS feed

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was looking at following example from link
http://www.jchq.net/certkey/0501certkey.htm




public class Shift2{
static int i=2;
public static void main(String argv[]){
System.out.println(32 % 32);
System.out.println( 3 >>> 32);
}
}
I clearly did not understood output.
I have not understood concepts behind >>>, >>,<<<,<<

Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
 
Java Cowboy
Sheriff
Posts: 16083
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the tutorials: Bitwise and Bit Shift Operators.

Note: The <<< operator does not exist. Only: >>, >>> and <<.
 
Marshal
Posts: 59096
180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what output do you get? What did you expect?
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!