I am working on an assignment t hat does not allow arrays or arraylists . I want to take a string of 100 random numbers, that looks like this "23 5 87 48 11 8 31", and format it into 5 columns. These numbers are coming from a tree when the tree is created. normally I would take each random number and put it into an array, put that array into a tostring method using modulus operator to print each array value on each line.
Because I can't use arrays, I need to explode the string, or somehow cut it up into something that's not an array. is this possible in java?
sorry for such a newbie question, thank you in advance.
By explode, I believe you mean separate the numbers in the String. You can wrap the String inside a Scanner and use the Scanner's hasNext() and next() methods to loop and print the numbers in a desired way.