title: AtomicInteger doesn't seem to be working for me
body: <p>I am trying to create a simple ten second countdown timer for my <code>Libgdx</code> game.  I have created a timekeep class which implements runnable and can do the ten second countdown fine.  However I want to print this <code>Timer</code> variable as it changes in my main game glass but I cannot do this for some reason.  I keep getting a nullpointer exception.  I figured it is probably a synchronization error since Render runs in its own thread and my timekeep runs its own thread.  I have tried volatile variables and a synchronized gettime method and now atomic integers with no success.  How can get the <code>Timer</code> variable from my timekeep class and print it from my main game class as it updates? Thanks</p>
  
  <p>Here is my timekeep class</p>
  
  <pre><code>public class timekeep implements Runnable {
      public volatile Boolean TimerRunning = true;
      //private int Timer = 10;//I want to print this variable as it counts down
      public AtomicInteger Timer = new AtomicInteger(10);
      public int Timeleft;
  
  
      @Override
  
      public void run() {
  
          while (TimerRunning == true) {
              System.out.println("Time left" + Timer);
              try {
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              if (Timer.equals(0)) {
  
                  TimerRunning = false;
  
              } else {
  
                  Timer.decrementAndGet();
  
              }
  
          }
  
      }
  
      public int getTimer() {
          return Timer.get();   
      }
  
  }
  </code></pre>
  
  <p>Other Main game screen class
  timekeep Timekeep;</p>
  
  <pre><code> //constructor
   Timekeep = new timekeep();
   //on show create the thread
   timekeep Timekeep = new timekeep();//inside show method in main game screen class
   Thread t1 = new Thread(Timekeep);
   t1.start();
   //inside the render method 
   System.out.println(Timekeep.getTimer());//inside render method in main game screenclass
  </code></pre>