Tracking down a NullPointerException
<p>I need to save data to MySQL database. Problem is that I have a lot of new data every second and need to filter it so I would save only necessary data. So, when I get new data, I create an object and call method processData. For some reason, this is not working. This is my method:</p>

<pre><code>import java.util.Date;
import org.llrp.ltk.types.UnsignedShort;
import hr.fer.rfid.MySQLAccess;
public class Brain {
    Data[] datas = new Data[]();
    Data[] temps = new Data[]();
    public void processValues(Data dat){

       if(temps==null){
           datas[0]=dat;
           temps[0]=dat;
       }
       for (i=0;i&lt;(temps.length+1);i++){
          System.out.println("Process value: "+i);
          if(i==(temps.length+1)){
             temps[i]=dat;
             datas[datas.length+1]=dat;
          }
          if(i&lt;=temps.length) {
           if(dat.epc==temps[i].epc)
              if((dat.antenna!=temps[i].antenna)
                ||((dat.date.getTime()-temps[i].date.getTime()&gt;=5000)
                  &amp;&amp;(dat.date.getTime()-temps[i].date.getTime()&lt;=20000))) {
                  temps[i]=dat;
                  try {

                   dao.writeToDatabase(dat);
                  } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                  }
              }
          }
       }
    }
 }
</code></pre>

<p>I get <code>NullPointerException</code></p>
