for (int i=0; i<cnt; i+=3) { int currVal = arr[i + 0]; int nextVal = arr[i + 1]; int next2Val = arr[i + 2]; ... }