There are different ways to do this but I am going to share the method that I use.
The method I use to encode is bitshifting. What you have to do is, to encode, you have to move the numbers into sequential 32-bit section. And to decode the integer, you do the opposite. I am also sharing the code I use:
pragma solidity 0.4.24;
contract Test {
    function encodeNumbers(uint256 a, uint256 b, uint256 c) public view returns(uint256 encoded) {
        encoded |= (a << 64);
        encoded |= (b << 32);
        encoded |= (c);
        return encoded;
    }
    function decodeNumber(uint256 encoded) public view returns (uint256 a, uint256 b, uint256 c) {
        a = encoded >> 64;
        b = (encoded << 192) >> 224;
        c = (encoded << 224) >> 224;
        return;
    }
}