> > On a small-endian machine, the values would only be converted to
> > big-endian when they're written to a file, or sent out over the network.
>
> Actually, I was wondering whether the Java Language Spec says anything
> about what byte order should prevail. I searched for it but couldn't
> find anything about endianness or byte order. Then again, I didn't
> read the whole darn lot.
>
> I now have two different opinions. Some say Java is big-endian, some
> say it depends which machine it's on. Who's right? Proofs, please.
I'm right :-) As has been pointed out, if you wrote a Java program
which could tell what endian your machine is, you would have a problem.
My JVM was designed to run on a small-endian machine - all maths, etc
is done in small endian. It would be silly not to. If it were
recompiled for a big-endian architecture I would need to change around
5 functions - 3 which read 2,4 and 8 byte quantities from classfiles,
and 2 others which write binary values to files (there may be a few
others) but that's it.
Peter
--
+---------------------------------------------+-----------------------------+
| Peter Naulls - [EMAIL PROTECTED] | |
| http://free.prohosting.com/~chocky/ | Java and JVM Consultant |
| Java for Risc OS and ARM - [EMAIL PROTECTED] | Technical Author |
| http://free.prohosting.com/~chocky/java/ | Program performance analyst |
+---------------------------------------------+-----------------------------+