Hi,
Can anyone help me to convert byte Array to integer?
Replace "byte" by "int" ![]()
What exactly do want to convert?
A byte is 8 bits, and integer is 16 bits or 2 bytes. A type long is 4 bytes.
You can only fit two bytes in an int and if your array contains more than 4 elements it won't fit into a long.
If you don't have too many bits, you can read and write one bit at a time from the byte array into the int/long with bitRead() and bitWrite().
Do you mean something like
int someInt = 0;
highByte(someInt) = byteArray[0];
lowByte(someInt) = byteArray[1];
and so on.