• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Logical Bitwise and shift operators

 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, has never anyone of you worked with Logical bitwise and shift operators? I was wondering on the utility of working with bits.
Regards,
Marco
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I once wrote an application that used bit flags because we were accepting data from another application that used bit flags.
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its definitely not the most commonly used functionality in the Java Language -- but it definitely has its purpose... and just for Sh**s and Giggles they put it on the exam
But more importantly -- by learning bit operations -- it really forces you to understand how numeric types work in Java -- how they can be manipulated and all that.
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Thomas Paul:
I once wrote an application that used bit flags because we were accepting data from another application that used bit flags.


Did you have to make operation with bites? I mean shift bytes to the left or to the right, make complements or addition or logical operation?
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jessica Sant:
its definitely not the most commonly used functionality in the Java Language -- but it definitely has its purpose... and just for Sh**s and Giggles they put it on the exam
But more importantly -- by learning bit operations -- it really forces you to understand how numeric types work in Java -- how they can be manipulated and all that.


My question was leading to that: i found useful to know how promotion works in java, how logical bitwise operator works and how the << and so on operators work but i was wondering if on the exam i would be demanded to convert data from decimal to octal, hexadecimal and binary. More than difficult it could be time-consuming and open to silly errors.
For istance how would you recognize that:
1 <<31 would lead to a negative number just reading a question on the exam?
Marco
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic