[1,2,3,4].pack("CCCC") # => "\001\002\003\004"[1,2].pack('s2') # => "\001\000\002\000"[1234].pack("i") # => "\322\004\000\000"