diff --git a/src/main/java/org/utility/timeunitbuilder/HoursBuilder.java b/src/main/java/org/utility/timeunitbuilder/HoursBuilder.java index 71701ac..864587a 100644 --- a/src/main/java/org/utility/timeunitbuilder/HoursBuilder.java +++ b/src/main/java/org/utility/timeunitbuilder/HoursBuilder.java @@ -34,19 +34,19 @@ public String build(long milliseconds) { long hours = TimeUnit.MILLISECONDS.toHours(milliseconds); long remainingTime = milliseconds - TimeUnit.HOURS.toMillis(hours); if (nextFormatter != null) { - return formattedMinutes(hours) + Constants.SPACE + nextFormatter.build(remainingTime); + return formattedHours(hours) + Constants.SPACE + nextFormatter.build(remainingTime); } else { - return formattedMinutes(hours); + return formattedHours(hours); } } /** - * Method to format the minutes to the desired format. + * Formats the hours value with the appropriate unit label. * - * @param hours the time in minutes - * @return formatted string in minutes format + * @param hours the time in hours + * @return formatted string in hours format */ - private String formattedMinutes(long hours) { + private String formattedHours(long hours) { return hours + Constants.SPACE + (hours > 1 ? Constants.HOURS : Constants.HOUR); } }