This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IO Quetion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IO Quetion" Watch "IO Quetion" New topic

IO Quetion

ricky gonzalez
Ranch Hand

Joined: Jun 30, 2000
Posts: 167
If write(0x01234567) is called on an instance of OutputStream, what will be written to the destination of the stream?
Select the right answer.
a The bytes 0x01, 0x23, 0x34, 0x45, and 0x67, in that order.
b The bytes 0x67, 0x45, 0x34, 0x23, and 0x01, in that order.
c The byte 0x01.
d The byte 0x67.
e None of the above.

Does anyone know?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
Java uses what is known as "network order" - the highest byte of a multi byte integer is written first. This is the opposite of the Windows / Intel convention.
john shen

Joined: Jul 23, 2000
Posts: 14
write(int b)
Writes the specified byte to this output stream.
this is what the javadoc says. this means that all but the right-most 4 bits are discarded during write. you can try it yourself.
I agree. Here's the link:
subject: IO Quetion
It's not a secret anymore!