> Essentially, I will be collecting a varaible number
> of longs. Te fixed length of arrays makes it seem
> inefficient and I am not sure what collection
> method/object I should be using otherwise.Please
> advise. Thank you.
You can use an ArrayList of Long.
An ArrayList basically is a dynamic array implementation so it will grow in size as you add the Longs.
Not that I write Long instaed of long. Long is the wrapper class of the long primitive. ArrayLists can only store objects so if you add longs they will be converted to Long objects instead. This is a drawback but it may not be a problem for you?
One possible strategy is to first collect the Longs in an ArrayList and then when you know the actual umber of longs create a static long array of that size.