java.lang.NumberFormatException: For input string: "null"
<p>I'm parsing a doc and I get the following error:</p>

<pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: "null"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
    at java.lang.Float.valueOf(Float.java:388)
    at CentroidGenerator$Centroid.averageLat(CentroidGenerator.java:403)
    at CentroidGenerator.getCentroids(CentroidGenerator.java:30)
    at CentroidGenerator.main(CentroidGenerator.java:139)
</code></pre>

<p>This is the part of code throwing the exception:</p>

<pre><code>if (latitude!=null) {
    //if (!latitude.equals("null")) {
        String[] latValues = latitude.split(" ");
    float sum = 0;
    for (int i = 0; i &lt; latValues.length; i++) {                
        sum = sum + Float.valueOf(latValues[i].trim()).floatValue();
    }
    latitude = Float.toString(sum / (float) latValues.length);
    //}
}   
</code></pre>

<p>As you can see I've tried to check for "null" strings but even uncommenting the second if statement I get the same error.</p>

<p>thanks  </p>
