public int[] read(Unpacker u, int[] to, boolean required)
            throws IOException {
        if (!required && u.trySkipNil()) {
            return null;
        }
        int n = u.readArrayBegin();
        int[] array;
        if (to != null && to.length == n) {
            array = to;
        } else {
            array = new int[n];
        }
        for (int i = 0; i < n; i++) {
            array[i] = u.readInt();
        }
        u.readArrayEnd();
        return array;
    }