Arduino Sketch for sending sensor turn on/off to computer
If I understand correctly, your goal is to report all state changes; a 500 ms blackout is undesirable. If I am correct, read on.

You don't need the nextTime array at all. Change the state array from false/true to LOW/HIGH:

level = digitalRead(i);
if (level != state[arrayIndex]) {
    state[arrayIndex] = level;
    serialWrite(i | (level &lt;&lt; 8));
}


(I am assuming that LOW == 0, and HIGH == 1).

Regarding performance: the code runs a busy loop, which is usually undesirable, especially in the embedded world. I seriously recommend to connect your pins to an interrupt, and rewrite the code into a reactive model.