@@ -0,0 +1,1428 @@
+package algorithms.timeinwords;%0A%0Aimport java.util.Scanner;%0A%0Apublic class Solution %7B%0A%0A%09private static String%5B%5D digits = new String%5B%5D%7B%22zero%22, %22one%22, %22two%22, %22three%22, %22four%22, %22five%22, %22six%22, %22seven%22, %22eight%22, %22nine%22, %22ten%22, %22eleven%22, %22twelve%22,%0A%09%09%09%22thirteen%22, %22fourteen%22, %22fifteen%22, %22sixteen%22, %22seventeen%22, %22eighteen%22, %22nineteen%22, %22twenty%22,%0A%09%09%09%22twenty one%22, %22twenty two%22, %22twenty three%22, %22twenty four%22, %22twenty five%22, %22twenty six%22, %22twenty seven%22,%0A%09%09%09%22twenty eight%22, %22twenty nine%22%7D;%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Scanner scanner = new Scanner(System.in);%0A%09%09int hours = Integer.parseInt(scanner.nextLine());%0A%09%09int minutes = Integer.parseInt(scanner.nextLine());%0A%09%09System.out.print(getTimeAsString(hours, minutes));%0A%09%7D%0A%0A%09private static String getTimeAsString(int hours, int minutes) %7B%0A%09%09if (minutes == 0) %7B%0A%09%09%09return String.format(%22%25s o' clock%22, digits%5Bhours%5D);%0A%09%09%7D%0A%0A%09%09if (minutes == 30) %7B%0A%09%09%09return String.format(%22half past %25s%22, digits%5Bhours%5D);%0A%09%09%7D%0A%0A%09%09if (minutes %3C 30) %7B%0A%09%09%09return String.format(%22%25s past %25s%22, getMinutesAsString(minutes), digits%5Bhours%5D);%0A%09%09%7D else %7B%0A%09%09%09return String.format(%22%25s to %25s%22, getMinutesAsString(60 - minutes), digits%5Bhours + 1%5D);%0A%09%09%7D%0A%09%7D%0A%0A%09private static String getMinutesAsString(int minutes) %7B%0A%09%09if (minutes == 0) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%0A%09%09if (minutes == 45 %7C%7C minutes == 15) %7B%0A%09%09%09return %22quarter%22;%0A%09%09%7D%0A%0A%09%09return minutes == 1 ? %22one minute%22 : String.format(%22%25s minutes%22, digits%5Bminutes%5D);%0A%09%7D%0A%7D%0A

add a simple clock challenge