title: how do I ignore/delete values of an array in java
body: <p>I have a list of words , there are 4 words, it cant contain more that 4 its just an example. I want to use just 2 of the words the rest of them should be ignored or deleted e.g :</p>
  
  <pre><code>    String planets = "Moon,Sun,Jupiter,Mars";
      String[] planetsArray = planets.split(",");
      int numberOfPlanets = planetsArray.length;
  </code></pre>
  
  <p>the result i get is 4. How do i delete the rest of the words if my list contains more that 2 words ? </p>