This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Integer converts to 2 octet integer? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Integer converts to 2 octet integer?" Watch "Integer converts to 2 octet integer?" New topic
Author

Integer converts to 2 octet integer?

M. Azri
Greenhorn

Joined: Jan 03, 2008
Posts: 2
I have a requirement that goes something like this:

- Integer should be transmitted in 1, 2, or 4 octet. Integers lager than 1 octet is transmitted with the least significant octet first.

- Example, integer 123 (007b hexadecimal) will be transmitted in a 2 octet integer as follows:

(Binary) 0111 1011 0000 0000
(Hex) 7 B 0 0

So how do I actually convert 123 to 2 octet integer in Java?

Put it in an array byte[4]? An example would be much appreciated.

Thanks.
Gregory Robinson
Greenhorn

Joined: Feb 02, 2008
Posts: 1
This this link

querycat

Regards,
Gregory
Olemera
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Integer converts to 2 octet integer?
 
Similar Threads
Integers near zero
left shift operation
How this output is coming regarding left shift operator
Shift operators !
Question from Khalidmughal for >>> operator