title: How do I print out only the first 3 elements of an array that has 5 elements in java?
body: <p>How do I only print out the first 5 elements of an array that has 10 elements?</p>
  
  <p>I know I can just do:</p>
  
  <pre><code>String[] strArray = {"bacon", "chicken", "ham", "egg", "poop"};
  System.out.println(strArray[0]);
  System.out.println(strArray[1]);
  System.out.println(strArray[2]);
  </code></pre>
  
  <p>But assuming I had 100 elements and wanted to print out the first 25 elements. Or wanted to print out all elements from the 10th to the 50th. Writing all the lines of code would take up time.</p>
  
  <p>Is there like a way to tell the console to print "from" one element to another? Sort of like from 10-50? So like a short-cut.</p>