fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. double rawDays = 4.46875;
  9. int days = (int)Math.floor(rawDays);
  10. double rawRestHours = (rawDays - days) * 24;
  11. int hours = (int)Math.floor(rawRestHours);
  12. double rawRestMinutes = (rawRestHours - hours) * 60;
  13. int minutes = (int)Math.floor(rawRestMinutes);
  14. double restSeconds = (rawRestMinutes - minutes) * 60;
  15. String date = String.format("%d days %2d:%2d:%05.2f", days, hours, minutes, restSeconds);
  16. System.out.println(date);
  17. }
  18. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
4 days 11:15:00.00