In Ruby 1.9.3, you can do
"\x00\x01".unpack 'S' #=> 1 * 256 + 0 = 256, my machine use little endian by default
"\x00\x01".unpack 'S>' #=> 0 * 256 + 1 = 1
But Ruby 1.8.7 doesn't have the ">" "<" annotation. So in 1.8.7, what is the best way to do unpack with big endian?