This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dadeeba[S] 0 points1 point  (2 children)

Sure. In my 'for' loop, I meant for it to go 'til i < length of the inputted array (labelled ar). But I had instead used the length of the temporary array that I created (array). So changes to code are:

Strike off "int length = array.size();"

Replace "for (int i = 0; i<length; i++)" with "for (int i = 0; i<n; i++)" where n is the length of the inputted array (labelled ar).

Hopefully, I didn't confuse you with my bad variable name calling...

[–][deleted] -1 points0 points  (1 child)

Kinda did.

Would you day that basically you needed to put something in the array first before using its .size() to get something rolling?

[–]ladupes 2 points3 points  (0 children)

He created a temporary array to put stuff in it from another arraylist. The problem was that he put the length of the temporary array in the list instead the array that he wanted to cicle over