I am trying to change the arrays size if some condition is not met. my user will input 20 numbers between 10 and 100 if one is a duplicate of the other don't add it to the array. here is the code I have. It won't add the duplicate number but it sets that array to zero instead I just want to eliminate that The code
ANY help is appreciated Ryan ------------------
[This message has been edited by Ryan Perlman (edited November 15, 2001).]
You'd have to ask the question in the Performance forum as to whether it is a good thing, but previously I have used the System.arraycopy() method. I tend to use the Collections framework rather than arrays (except on the rare occasion) so it's been a while. Dave.
Once you create an array it's size cannot be changed. You could (once your 20 numbers have been input) go through your array counting the non-zero ints and create a new array of that size, then go through again copying accross the non-zero ints. OR you could get into Collections (in which case you would need to use the Integer class instead of int) and discover how simple it is to manipulate a set of objects like Integer.