```scala
var i = 0
while (i < len) {
  dos.write(0)
  i += 1
}
```
(Can't believe I just suggested very procedural Scala code :wink:)