coding and decoding into integers