So, now it looks correct, but I still don't see the reason of having this `k` variable. For what it is?
And I would prefer having a `for` loop like (equivalent to your `while` loop but much clear):

```java
for (int i = columnPointers[j]; i < columnPointers[j + 1]; i++) {
  procedure.apply(rowIndices[i], j, values[i]);
}
```