private static String numberToString(int n) {
        if (n < 1 || n > 1000) {
            return "";
        }

        if (n <= 20) {
            return numberMap.get(n);
        }

        if (n == 1000) {
            return "onethousand";
        }

        String result = "";

        if (n >= 100) {
            int hundredsDigit = n / 100;
            result += numberMap.get(hundredsDigit) + "hundred";
            n = n % 100;

            if (n == 0) {
                return result;
            }

            result += "and";
        }

        if (n <= 20) {
            return result + numberMap.get(n);
        }

        int tensDigit = n / 10;
        int onesDigit = n % 10;
        result += numberMap.get(tensDigit * 10) + numberMap.get(onesDigit);

        return result;
    }