public String toMorse(String text)
  {
    String result = "";
    int charToMorseLength = CHAR_TO_MORSE.length;

    StringCharacterIterator iterator = new StringCharacterIterator(text);

    char character = Character.toUpperCase(iterator.first());
    while (character != StringCharacterIterator.DONE)
    {
      int index = (int)character - FIRST_CHAR_CODE;

      if (index >= 0 && index < charToMorseLength)
        result += CHAR_TO_MORSE[index];

      character = Character.toUpperCase(iterator.next());

      if (character != StringCharacterIterator.DONE)
        result += " ";
    }

    return result;
  }