Skip to content

Instantly share code, notes, and snippets.

@khunzohn
Last active June 24, 2017 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khunzohn/18a6c6ca4862cb4ebcfb12dd1f0bb75b to your computer and use it in GitHub Desktop.
Save khunzohn/18a6c6ca4862cb4ebcfb12dd1f0bb75b to your computer and use it in GitHub Desktop.
public class Utils {
public static String mapDigitToWord(int digit) throws DigitRangeException {
if(digit < 0 || digit > 9)
throw new DigitRangeException();
switch (digit) {
case 0: return "Zero";
case 1: return "One";
// case 2,3,...9
default: return "";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment