| 1 | Start outer loop | 0 | - | - | Compare pattern at text[0] | [] |
| 2 | Compare chars | 0 | 0 | text[0] == pattern[0] ('a'=='a') | Continue | [] |
| 3 | Compare chars | 0 | 1 | text[1] == pattern[1] ('b'=='b') | Continue | [] |
| 4 | Compare chars | 0 | 2 | text[2] == pattern[2] ('c'=='c') | Continue | [] |
| 5 | Compare chars | 0 | 3 | text[3] == pattern[3] ('d'=='d') | Continue | [] |
| 6 | Compare chars | 0 | 4 | text[4] == pattern[4] ('a'=='a') | Continue | [] |
| 7 | Compare chars | 0 | 5 | text[5] == pattern[5] ('b'=='b') | Continue | [] |
| 8 | Compare chars | 0 | 6 | text[6] == pattern[6] ('c'=='c') | Continue | [] |
| 9 | Compare chars | 0 | 7 | text[7] == pattern[7] ('d'=='d') | Continue | [] |
| 10 | Compare chars | 0 | 8 | text[8] == pattern[8] ('a'=='a') | Continue | [] |
| 11 | Compare chars | 0 | 9 | text[9] == pattern[9] ('b'=='b') | Continue | [] |
| 12 | Compare chars | 0 | 10 | text[10] == pattern[10] ('c'=='c') | Continue | [] |
| 13 | Compare chars | 0 | 11 | text[11] == pattern[11] ('d'=='d') | Continue | [] |
| 14 | Pattern fully matched | 0 | 12 | j == pattern.length (12) | Record match at i=0 | [0] |
| 15 | Increment i | 1 | - | - | Compare pattern at text[1] | [0] |
| 16 | Compare chars | 1 | 0 | text[1] == pattern[0] ('b'=='a') | Mismatch | [0] |
| 17 | Increment i | 2 | - | - | Compare pattern at text[2] | [0] |
| 18 | Compare chars | 2 | 0 | text[2] == pattern[0] ('c'=='a') | Mismatch | [0] |
| 19 | Increment i | 3 | - | - | Compare pattern at text[3] | [0] |
| 20 | Compare chars | 3 | 0 | text[3] == pattern[0] ('d'=='a') | Mismatch | [0] |
| 21 | Increment i | 4 | - | - | Compare pattern at text[4] | [0] |
| 22 | Compare chars | 4 | 0 | text[4] == pattern[0] ('a'=='a') | Continue | [0] |
| 23 | Compare chars | 4 | 1 | text[5] == pattern[1] ('b'=='b') | Continue | [0] |
| 24 | Compare chars | 4 | 2 | text[6] == pattern[2] ('c'=='c') | Continue | [0] |
| 25 | Compare chars | 4 | 3 | text[7] == pattern[3] ('d'=='d') | Continue | [0] |
| 26 | Compare chars | 4 | 4 | text[8] == pattern[4] ('a'=='a') | Continue | [0] |
| 27 | Compare chars | 4 | 5 | text[9] == pattern[5] ('b'=='b') | Continue | [0] |
| 28 | Compare chars | 4 | 6 | text[10] == pattern[6] ('c'=='c') | Continue | [0] |
| 29 | Compare chars | 4 | 7 | text[11] == pattern[7] ('d'=='d') | Continue | [0] |
| 30 | Pattern fully matched | 4 | 12 | j == pattern.length (12) | Record match at i=4 | [0,4] |
| 31 | Increment i | 5 | - | - | Compare pattern at text[5] | [0,4] |
| 32 | Compare chars | 5 | 0 | text[5] == pattern[0] ('b'=='a') | Mismatch | [0,4] |
| 33 | Increment i | 6 | - | - | Compare pattern at text[6] | [0,4] |
| 34 | Compare chars | 6 | 0 | text[6] == pattern[0] ('c'=='a') | Mismatch | [0,4] |
| 35 | Increment i | 7 | - | - | Compare pattern at text[7] | [0,4] |
| 36 | Compare chars | 7 | 0 | text[7] == pattern[0] ('d'=='a') | Mismatch | [0,4] |
| 37 | Increment i | 8 | - | - | Compare pattern at text[8] | [0,4] |
| 38 | Compare chars | 8 | 0 | text[8] == pattern[0] ('a'=='a') | Continue | [0,4] |
| 39 | Compare chars | 8 | 1 | text[9] == pattern[1] ('b'=='b') | Continue | [0,4] |
| 40 | Compare chars | 8 | 2 | text[10] == pattern[2] ('c'=='c') | Continue | [0,4] |
| 41 | Compare chars | 8 | 3 | text[11] == pattern[3] ('d'=='d') | Continue | [0,4] |
| 42 | Pattern fully matched | 8 | 12 | j == pattern.length (12) | Record match at i=8 | [0,4,8] |
| 43 | Increment i | 9 | - | - | Compare pattern at text[9] | [0,4,8] |
| 44 | Check loop condition | 9 | - | 9 <= 20 - 12 (8)? | False | [0,4,8] |