How would you serialize a large array with 10^9 values?-Collection of common programming errors

Your example simply stores the index + 1 in each array element; you can get this via a calculation at runtime, there is no need to store or serialize anything.

Even if your example is made-up and you are actually trying to store 10^9 arbitrary integers, you are probably going to going to have many duplicates. In this case you should be using a sparse data structure, not an array.

Addendum: If the values are primary keys and must be unique, you may be better off storing the numbers that are not used rather than the ones which are.