1) Yes, the loop will take care of this. The way I had it before, I was allocating the int inside of that if statement, so it actually would save the allocation of the int if the length was 0. After I decided to give a proper snippet I just decided to make it a method and forgot to change it after I moved things around.
2) You are correct, but I always feel it is good to do my own null checks. I have learned that you can never be too careful. Where I work, we are constantly writing safety critical applications, and you cant assume anything, and can never be too safe.
The null check could be considered redundant, but it is good practice to use defensive programming, especially when scripting.
Defensive programming is in my blood.
Edit: Also, in your example, I dont think you will ever need a long to store the number of buckets on the ground. :p