title: how to split list of strings into multiple list dynamically in java
body: <p>I want to split list of strings into multiple list based on input value dynamically using java program.</p>
  
  <p>For eg.
  If Im having the below list of string</p>
  
  <pre><code>     List&lt;String&gt; messages = Arrays.asList("Hello", "World!", "How", "Are", "You");
  </code></pre>
  
  <p>I have to split the list of string into multiple lists with the condtion if i entered 2 as input value each splited list should contain 2 values in it.</p>
  
  <p>Note: How many values the list should contain be based  on input value</p>
  
  <pre><code>       outputshould be: 
         list1 contains-&gt; Hello,world
         list2 contains -&gt; How,Are
         list3 contains -&gt; you
  </code></pre>