Computer Science Canada integer/short to byte array |
Author: | chopperdudes [ Wed May 04, 2011 1:10 pm ] |
Post subject: | integer/short to byte array |
pretty much... google tells me how to do it in java, and i wasn't successful at finding out how to do it "manually". I'm not very good at these low level stuff, but am thinking of using turing's net commands and making a communication link between 2 programs. i think stuff might work if i can somehow converted for example a short to a byte array of length 2 and an int to a byte array of length 4. is there any way to do this in turing? or how would you do it manually (i.e. on paper if this is possible)? thanks |
Author: | Tony [ Wed May 04, 2011 1:29 pm ] | ||
Post subject: | Re: integer/short to byte array | ||
write the number out
|
Author: | DemonWasp [ Wed May 04, 2011 1:35 pm ] |
Post subject: | RE:integer/short to byte array |
Within Turing, you will want what are called "bitwise operators". In Turing, those are shl, shr, or, and (shift left, shift right, bitwise-or, bitwise-and). |
Author: | chopperdudes [ Wed May 04, 2011 1:53 pm ] |
Post subject: | RE:integer/short to byte array |
oh i see thanks, tony's explaination was pretty much what i was looking for. also... now that i look into it... might as well just use java for the TCP/IP communication link... |