Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

bit shifting example

 
Mathew Lee
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.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15438
41
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 <<.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49776
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what output do you get? What did you expect?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic