I don't get the point of this either, is that you want to get a more accurate estimate?  In that case wouldn't you just remove the conditional and do:

```scala
      for (i <- 0 until length) {
         state.enqueue(JArray.get(array, i))
       }
```

Maybe I'm missing some context...