binary encoder for ints, longs, strings, relevant tests