title: Converting input to multiple ints / vars
body: <p>i am running into a problem while making ints / vars.
  While knowing how many input numbers there are, i can make a code like:</p>
  
  <pre><code>Scanner in = new Scanner(System.in);
  int[] vars = new int[8];
  for(int z = 0; z &lt; vars.length; z++)
    vars[z] = in.nextInt();
  </code></pre>
  
  <p>But the problem is that i don't know how many inputs there are going to be.
  The task in short is to recommend buyer to which product they should buy, so first two input numbers will be how many products there are and how many customers there are. Next X inputs will be prices of the products and next Y inputs will be the amount of money customers have. And all of that has to be in the same input.</p>
  
  <p>Shortly: I need to make a code that automatically names inputs to ints, depending how many input numbers there are.</p>
  
  <p>Could I name inputs depending on the line?
  Example:</p>
  
  <pre><code>input
  5 5
  1 5 8 11 12
  10 5 9 12 13
  </code></pre>
  
  <p>Edit:
  Could also someone ( @Noixes / @Raju Sharma ) give me a little tip how could I start managing with those inputs to find the best solution to every client? So every client would buy the item of his money or less(closest to the amount of his money)? After one client buys the item. The item would still be on the shop at the same price.</p>