title: checking the number of arguments before calling the method in Java
body: <p>In my program, I have a method which is below;</p>
  
  <pre><code>private void foo(String title, String[] subtitles, int ... subtitleValues)
  </code></pre>
  
  <p>My requirement is ;</p>
  
  <ul>
  <li>number of subtitles and subtitleValues must be equal. User can send any number of subtitles and subtitle values but as I said <strong>equal number of subtitles and subtitleValues.</strong></li>
  </ul>
  
  <p>I don't want to take both arguments and check their counts in <code>foo</code> function and say your table can not be created because of unequal subtitles and subtitleValues. What I want is; prevent user to send unequal arguments. How can I do that?</p>
  
  <p>Thanks in advance</p>
  
  <p>PS : I didn't find a proper title, so if you have, please feel free to change it.</p>