title: How to print a countdown in the same line
body: <p>I have a code where I want to print counters in the same output line. It is supposed to be like this: a name (that is fixed) and the seconds would be running until 0 on its side.</p>
  
  <p>The following code is what I have now:</p>
  
  <pre><code>public void CountdownToZero(String name, int secs) {
      int delay = 1000;
      int period = 1000;
      timer = new Timer();
      interval = secs;
      System.out.print(name +" "+ secs);
      timer.scheduleAtFixedRate(new TimerTask() {
          public void run() {
              System.out.print(name + " " + setInterval());
          }
      }, delay, period);
  }
  
  private static final int setInterval() {
      if (interval == 1)
          timer.cancel();
      return --interval;
  }
  </code></pre>
  
  <p>And the actual output is:</p>
  
  <pre><code>name 5
  name 4
  name 3
  name 2
  name 1
  name 0
  </code></pre>
  
  <p>And what I'd want to appear on the output would be:</p>
  
  <pre><code>name [countdown seconds to 0]
  name1 [countdown seconds to 0]
  name2 [countdown seconds to 0]
  </code></pre>
  
  <p>Can someone help me in this case?
  Thanks in advance!</p>