Convert an length byte integer to an array of bytes.

def int_to_array(i, length=2):
    """Convert an length byte integer to an array of bytes."""
    res = []
    for dummy in range(0, length):
        res.append(i & 0xff)
        i = i >> 8
    return reversed(res)