You can use reinterpret. It's fast! julia> a = [UInt8(i) for i=1:4] 4-element Array{UInt8,1}: 0x01 0x02 0x03 0x04
julia> reinterpret(UInt32, a) 1-element Array{UInt32,1}: 0x04030201 On Wed, Apr 27, 2016 at 11:05 PM, Achu <ach...@gmail.com> wrote: > Hi > > I'm trying to read a data stream off a server for our motion capture > system. The protocol > <https://qualisys.github.io/Real-Time-Protocol-Documentation/>says that > the first four bytes represent the size of the whole packet and I can read > that using readbytes(). To convert four UInt8s into one UInt32, I'm > using > s=bytes2hex(a) #where a is a Vector UInt8, 4 > parse(UInt32,"0x"*s) > > Is there a better way to do this? > > Thanks! > Achu >