Use Math.floorDiv().

This commit is contained in:
Isira Seneviratne 2022-08-15 21:01:12 +05:30
parent c1a7c2ce11
commit 0aefc8e14d
4 changed files with 7 additions and 9 deletions

View file

@ -248,10 +248,10 @@ public class Utility {
return number < 10 ? ("0" + number) : String.valueOf(number);
}
public static String stringifySeconds(double seconds) {
int h = (int) Math.floor(seconds / 3600);
int m = (int) Math.floor((seconds - (h * 3600)) / 60);
int s = (int) (seconds - (h * 3600) - (m * 60));
public static String stringifySeconds(final long seconds) {
final int h = (int) Math.floorDiv(seconds, 3600);
final int m = (int) Math.floorDiv(seconds - (h * 3600L), 60);
final int s = (int) (seconds - (h * 3600) - (m * 60));
String str = "";