daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class addBinaryNumbers {
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         int time = 86399, // in seconds
  6.  
  7.             hours = time / 3600,
  8.  
  9.             minutes = (time - (hours * 3600)) / 60,
  10.  
  11.             seconds = time - (hours * 3600) - (minutes * 60);
  12.  
  13.  
  14.         if (hours < 10) {
  15.             System.out.println("0" + hours + ":" + minutes + ":" + seconds);
  16.         }
  17.         else if (minutes < 10) {
  18.             System.out.println(hours + ":0" + minutes + ":" + seconds);
  19.         }
  20.         else if (seconds < 10) {
  21.             System.out.println(hours + ":" + minutes + ":0" + seconds);
  22.         }
  23.         else {
  24.             System.out.println(hours + ":" + minutes + ":" + seconds);
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top