title: Taking any number of space separed inputs till a new line
body: <p>How should i take unknown number of space separated integers as inputs until the user presses enter in java and store inputs of each line in separate arrays.</p>
  
  <p>For eg: If I have the following lines as input,</p>
  
  <p>1 2 3 4 5</p>
  
  <p>2 4 6 8 10</p>
  
  <p>then one array stores 1st line (say) arr1={1,2,3,4,5}
  and the next array stores 2nd line (say) arr2={2,4,6,8,10}</p>
  
  <p>I have tried using scanner class to take the space separated integer inputs but am unable to switch to next array when a new line is encountered.</p>