java - from file to arraylist, from arraylist to array[] -
i have text file contains this:
1 1 0 0 1 2 0 0 1 0 1 0 1 0 2 0 1 0 0 1 1 0 0 2 2 1 0 0 2 2 0 0 2 0 1 0 2 0 2 0 2 0 0 1 2 0 0 2
then, put contents in arraylist. result same in file. next, want process data 1 1 , put each row of content in array[][] the data seperated row. result this:
output[0][]={1 1 0 0} output[1][]={1 2 0 0} output[2][]={1 0 1 0} output[3][]={1 0 2 0} .... .... ....
question, how can take string in arraylist become separated data? code in java
thanks
you can use " public string[] split(string regexp)" method split string in array specifying character split in argument. e.g.string temp = "1 2 3 4"; temp.split(" "); split blank space in case..
Comments
Post a Comment