So I need to print out an array of integers. The problem is that when user enters the numbers to be processed and sorted, I do not know how many numbers there will be entered by the user. The only rule to that is that user can enter only less than 10000 numbers.
So I made an array which can hold 10000 numbers but if user enters less than 10000 numbers into the array then Array.toString() function prints out everything, even the empty spaces.
Is there any way to bypass that or are there any other methods for outputting an array in one line that would format it the output to look like this: [1, 2, 3, 4, 5, 6]
Thanks a lot!
ArrayList<T>?