Seconds To Hours Java

class SecondsToHoursMinutes {
    public static void main(String[] args)
    {	int totalSecs = 23456;
    	int hours = totalSecs / 3600;
	int minutes = (totalSecs % 3600) / 60;
	int seconds = totalSecs % 60;
 
	System.out.println("Hours: " + hours);
	System.out.println("Minutes: " + minutes);
	System.out.println("Seconds: " + seconds);
    }
}

Output

Hours: 6
Minutes: 30
Seconds: 56
Content Protection by DMCA.com
Please Share