From: paul.rogers@... (Paul) Date: 2004-09-23T03:14:34+09:00 Subject: negative numbers and binary formats Im trying to take a negative integer value, convert it to its binary equivalent, and save its hex value -7 -> 1111 1001 -> F9 I was hoping to use sprintf, but: irb(main):017:0> b = sprintf("%4b" , a) => "..1001" irb(main):018:0> The .. that appear break any further processing. So my questions are: Why the dots, and what are they? How do I do what Im trying to do - given my -7 in the example may be a 1 byte, 2 byte or 4 byte value. ( Im sure its some magic with pack....) Thanks Paul