# How do I know which noteOff MidiMessage is for which noteOn MidiMessage?

I’m going through the MidiMessage documentation, and I can’t find a way to correlate note offs with which note they’re turning off.

For instance, how do I differentiate between these two sets of on’s and off’s:

(One starts1, starts2, stops2, stops1, and the other starts1, starts2, stops1, stops2).

The note numbers are the same, what could be different about them? If two different notes are played, only differentiating in velocity, how do I know which note ends when the midi noteOff message arrives?