title: Removing unfilled values or null values from array of String in Java
body: <p>I have following String Array 
   <code>tmp = [null, null, null, Mars, Saturn, Mars]</code> coming after doing the operation -
  <code>allSig[d3].split(" ");</code> where <code>allSig</code> is an array of Strings. The null value is empty value in the array. Now I want to remove the null. For this I am using</p>
  
  <p><code>tmp[indexNumber] != null</code> is not working and giving true ; taking null as the value. Even if i am using "null" as a string is not working.</p>
  
  <p>How to remove this.</p>
  
  <pre><code>public static String[] removeElements(String[] allElements) {
      String[] _localAllElements = new String[allElements.length];
  
      for (int i = 0; i &lt; allElements.length; i++)
          if (allElements[i] != null)
              _localAllElements[i] = allElements[i];
  
      return _localAllElements;
  }
  </code></pre>