This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com