In short, integer encoding is mechanism to compact multiple integer values into single byte array. It is well described in literature  and in this post we will review exemplary implementation.
Unless one wants to re-implement encoding algorithms, we will reuse Varint class from mahout-core .
Simplest use-case for 2 integers looks like:
Here, we declared structure of 2 integers - Tuple2I, and followed it by Encoder example that encodes and decodes integers to and from byte array.
For real-world usages of the Integer encoder, refer to Surus . By wide adoption of integer encoding on 3 and 4 integer tuples, I was able to reduce Mapper output by 20-30%, and saved about 30 minutes of computation time.
 Data-Intensive Text Processing with MapReduce
 Typical Maven repository