ruby style byte-packing for scala