• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Shifting

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

When using right shift operator
int x = 2;
int y = x >> 34;

We end up shifting by 34 % 32

I have doubt about left shift operator.

when using left shift operator and >>> operators

whether we end up shifting by 34 % 32 or not
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, because the >>> operator is similar to >> except that sign extension
(preserving sign bits on left hand side) that takes place in >>, doesnt take place for >>>. Thats all

I think the code fragment you posted is from K&B book isnt it ???

i just read the article from the book and happy to reply to your query

correct me if i am wrong
 
Krishna Latha Grandhi
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Niranjan,

Thank you for feed back. Yes it is from k&B book. I just tested it by writing program. You r right.

Regards
krishna.
 
Krishna Latha Grandhi
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

Can we have required to know the bit representation to write SCJP 1.4. Because to convert an int to bits requires some time. whether any questions in SCJP like in this way.
help plz..


Regards
krishna.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well...sine i am an electronics and telecomunication engineer i have already done that 'int' to bit conversion stuff.

but it takes time..well..i thnk somwwher in chapter 2 or 1 K&B
its mentioned that you need to know the conversions

hey, do you have a yahooo messenger id? i am preparing for 1.4 exam
we can chat on our preparation and help each other
 
Krishna Latha Grandhi
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeh. But Most of the time I will be in office. In our office yahoo messenger is not permitted. We are using icq messenger. we have clients from europe only.. my yahoo id is grandhi_krishna
 
I've been selected to go to the moon! All thanks to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic