That is fully correct :-) However I'd recommend you using set(index, obj) to set the object to the specified position at the end of your array..

As Phenix already mentioned: the add() function really ADDS an item, therefore you'd not have to resize the array by yourself nor keep track of the index or size. If you want to resize by hand, use set.