copying String array into a new String array
<p>what am i doing wrong here? i want to somehow eliminate empty elements within my String array. This is what i have tried so far: </p>

<pre><code>    String version = null; 
    String[] xml = new String[str.length]; 
    for(int i = 0; i &lt;= str.length -1; i++)
    {
        if(str[i] == "")
        {

        }
        else
        {
            xml[i] = str[i]; 
        }
    }






    String version = null; 
    String[] xml = new String[str.length]; 
    for(int i = 0; i &lt;= str.length -1; i++)
    {
        if(!str[i].equals(""))
        {
            xml[i] = str[i]; 
        }
    }



    String version = null; 
    String[] xml = new String[str.length]; 
    for(int i = 0; i &lt;= str.length -1; i++)
    {
        if(!str[i].isEmpty())
        {
            xml[i] = str[i]; 
        }
    }




     String version = null; 
    String[] xml = new String[str.length]; 
    for(int i = 0; i &lt;= str.length -1; i++)
    {
        if(str[i].isEmpty() == false)
        {
            xml[i] = str[i]; 
        }
    }
</code></pre>

<p>no matter which one i try, it always goes into copying all the values :S I've checked the locals, and it is clear that there are empty arrays within the String array</p>
