First off, that's a really confusing way to parse a number, why not just do:
int ret = 0;
for (int i = 0; i < count; i++) {
ret += (message[index] & 0xFF) << (8 * i);
index++;
}
return ret;
I see that you are using it for short, but are you using it for long too? That would cause an...