• 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

byte datatype!

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
could you please explain me when do we need byte datatype? similarly, could you also please tell me the situation the Shift operators (>>, >>>) are required?
thanks.
[ edited to diable smilies -ds ]
[ June 15, 2003: Message edited by: Dirk Schreckmann ]
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The byte datatype is needed to store integer values within range in the least amount of memory. A JVM might be implemented on processors with smaller than 32-bit registers, and memory resources are not always abundant.
Not many people "have" to use bit-shifting in "normal" coding. It's been a while, but IIRC some compression algorithms use bit-shifting. I'm sure there are other situations too.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some mathematical operations can be done more quickly with the bit shifting operators.
The byte datatype is also useful when the data to be used/manipulated is available in byte-sized pieces (such as with some I/O operations).
[ June 22, 2003: Message edited by: Dirk Schreckmann ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic