I have a situation, where I have to apply a criteria on an input array and reuturn another array as output which will have smaller size based upon the filtering criteria.
Use LinkedList instead. Than, you can create an array if necessary.
LinkedList