[Edit: fixed code tags]
Tanner odell wrote:...im stuck with how to output the array i have made so that it doesnt include the 0s that are in it, is there a way to go about doing via print statement formatting or am i going to have to take the array ive made and do something else with it. as of now its of size 100 which it has to be there are not 100 factors to say the number 6 there are only 4 so the array is putting 0s into every other spot. so thats 96 zeros, when i print the array it has all of those 0s how can i get rid of those? i know i can do this with a arrayList but i cannot use one of those for this.
1. Nothing is "putting" 0's in your array (except perhaps the JVM). It is the "default" value for an int, so when you set up an array of int's, they will ALL be set to 0 initially.
2. No, there is no formatting that I know of that will "ignore 0's". It's your specific requirement, so you need to do it yourself.
3. As I see it, you have two options:
(a) Loop through your array, and only print out elements that are not 0.
(b) Copy the non-zero elements of your array to another array of the correct size. That task might be made easier if you keep track of how many 'factors' you fill in.
It should be added that all of the above assume that 0 cannot possibly be a "valid" value, which for factors is probably true.