I understood that Java always uses Big Endian. Why does the code at How can I store and retrieve Unicode or Double Byte data in a file using the java.io libraries? produce Little Endian output?

Joe Sam Shirah

Actually, Java's guaranteed usage of Big Endian only applies to what I will loosely call "numbers." String or byte encodings for characters are a different matter altogether. The Little Endian output in the referenced code results from Java's interpretation of the "Unicode" alias, which on NT, at least, apparently resolves to "UnicodeLittle." This is not a problem in the code, because a byte order mark is written, but it would have been better to use an encoding from character encoding or Supported Encodings.