4 consecutive bytes in buffer to unsigned long
If they were in the same endian order as a long (little-endian on an Arduino, which they don't appear to be) you could just point to them:

uint32_t *l = (uint32_t *)&amp;packetBuffer[40];


Then use *l to access the content as a long.

However since they look to be in a big-endian order it's not that simple. The simplest thing you can do is just re-combine them with bit-shifting:

uint32_t l = ((uint32_t)packetBuffer[40] &lt;&lt; 24) | ((uint32_t)packetBuffer[41] &lt;&lt; 16) | 
             ((uint32_t)packetBuffer[42] &lt;&lt; 8) | (uint32_t)packetBuffer[43];