Java arrays and Scala arrays are the same, no need to call `toArray()` twice here.