Search Results

Search found 1 results on 1 pages for 'zzaw'.

Page 1/1 | 1 

  • How to split up input from System.in

    - by zzaw
    Alright so I'm working on something where I take input from System.in; the first line is an int (n) representing the size of a matrix. The next n lines are the matrix itself like so: 10 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The problem is there may be multiple matrix's in a single input, so the next line would have another int and the corresponding matrix underneath until it hits a line with a single 0. I then have to pass each matrix along with the size at the top as a BufferedReader to a method which adds the numbers to a 2D array. I'm just a little unsure on how to split the input up and send it to the method. Would making a new BufferedReader using skip() and specifying a size each time work? The biggest problem I seem to be running into is reading the size but then the size being excluded as it has already been read. Cheers

    Read the article

1