Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]) to get an array (using the first post's code)
You definitely don't know java. Sorry to tell you that. Hover over the .lenth method. What does it say?
Your not giving the right answer. The line with the error is caused by .getOnlinePlayers() not returning an array anymore, so it cannot be set to an array variable.