title: Java convert seconds to days, hours, minutes, seconds with unique outputs
body: <p>So I need to convert seconds to days, hours minutes seconds.</p>
  
  <p>But I need to have unique outputs for the times and if they return a zero not include them in the response.  </p>
  
  <p>So if 3600 seconds in input it needs to return 1 hour and nothing else.  How do I skip a line if a response is returned 0.  </p>
  
  <p>Here is the code that I have so far.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class ps9 {
  public static void main(String [] args){
      Scanner in = new Scanner(System.in);
      System.out.println("Enter number of seconds");
      int input = in.nextInt();
  
      int numberOfDays;
      int numberOfHours;
      int numberOfMinutes;
      int numberOfSeconds;
  
      numberOfDays = input / 86400;
      numberOfHours = (input % 86400 ) / 3600 ;
      numberOfMinutes = ((input % 86400 ) % 3600 ) / 60;
      numberOfSeconds = ((input % 86400 ) % 3600 ) % 60;
  
      if (numberOfDays &gt; 0) {
          System.out.println(numberOfDays + " day(s)");
          if (numberOfHours != 0)
          System.out.println(numberOfHours + " hour(s)");
          nextLine;
          System.out.println(numberOfMinutes + " minute(s)");
          System.out.println(numberOfSeconds + " second(s)");
      }
       else if (numberOfHours &gt;= 0 )
      {
          System.out.println(numberOfHours +" hour(s)");
          System.out.println(numberOfMinutes + " minute(s)");
          System.out.println(numberOfSeconds + " second(s)");
      }
      else if (numberOfMinutes &gt;= 0 )
      {
          System.out.println(numberOfMinutes + " minute(s)");
          System.out.println(numberOfSeconds + " second(s)");
      }
      else if (numberOfSeconds &gt;= 0)
      {
          System.out.println(numberOfSeconds + " second(s)");
      }
  }
  </code></pre>
  
  <p>}</p>