• 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

BigEndian and LittleEndian

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm hoping that this is being posted in the correct section... If not, I am sorry I'm still fairly new to the language.

Could someone give me a brief explanation on how endianess works in Java? Better to ask, in what senario would Endianess come into play and how would/should it be used? I only know what I've read on Wikipedia and that really doesn't help me much if I don't have some comprehensive examples :P .

-Thanks
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The way values are stored in Java is not something you generally need to worry about - is there a specific reason why you need to know this?
To find out information such as this you need to read the JVM Specification. If you read chapter 4 in the JVM spec you will see it states multibyte items are stored in BigEndian order.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would generally have to think about endianness if you have a network connection to some other machine, and are sending/receiving raw bytes. Such a process would generally use the byte order that is the default on the system it runs on - which may or may not be the same byte order of the machine where your code runs.

As Tony said, Java generally uses "network byte order" (BigEndian) so I think for communication between Java processes it's generally not a problem. But if one of the processes is not implemented in Java, you may have to do something about it (which may not be all that hard).
reply
    Bookmark Topic Watch Topic
  • New Topic