so i tried but failed miserably, mainly because i am not used to work with bytes.
say i have 4 byte octets that i want to convert to a single long
tried
say i have 4 byte octets that i want to convert to a single long
B4X:
long result = 0;
for (byte octet : octets) {
result <<= 8;
result |= octet & 0xff;
}
return result;
tried
B4X:
dim result as long = 0
for each octet as byte in octets
result = bit.shiftleftlong(result,8)
result = bit.or(result,octet & 0xff)
next
return result