a long ... convert it into a byte array
Maybe something like:
[CODE lang="b4x" title="To Bytes and Back" highlight="5,6,16"]Dim T As Long = DateTime.Now
Log(T)
Log(Bit.ToHexStringLong(T))
Dim bc As ByteConverter
Dim B() As Byte = bc.LongsToBytes(Array As Long(T))
Log(B.As(List)) 'works in B4J, might work in B4A
'Bytes are signed ie -128 to 127, use Bit.And if you need them unsigned 0..255 (you don't yet, but you might later)
Log(B.Length)
For I = 0 To B.Length - 1
Log(I & TAB & B(I) & TAB & Bit.And(B(I), 0xFF))
Next
Dim ReceivedT As Long = bc.LongsFromBytes(B)(0) 'note the (0) at the end, to "convert" the single element Long Array to a Long, by selecting element 0
Log(ReceivedT)
Log(Bit.ToHexStringLong(ReceivedT))[/CODE]
[CODE lang="b4x" title="Log output"]Waiting for debugger to connect...
Program started.
1714165429229
18f1c38b3ed
(ArrayList) [0, 0, 1, -113, 28, 56, -77, -19]
8
0 0 0
1 0 0
2 1 1
3 -113 143
4 28 28
5 56 56
6 -77 179
7 -19 237
1714165429229
18f1c38b3ed[/CODE]