I\'m aware that you can use DateUtils.formatElapsedTime(seconds) to convert a number of seconds into a String with the format HH:MM:SS
MadProgrammer has already provided a good Java 8 answer (which will work in Java 6 and 7 too when you use the ThreeTen Backport). In Java 9 still a bit more of the calculation can be done in the library:
int seconds = 3665;
Duration dur = Duration.ofSeconds(seconds);
String formatted = String.format("%d:%02d", dur.toHours(), dur.toMinutesPart());
System.out.println(formatted);
Output:
1:01
The toMinutesPart method and other toXxxPart methods were introduced in Java 9.