Java Morse Code Translator
<p>I'm relatively new to the Java programming language, and one of the projects I am working on is a Java morse code translator (Morse to English and vice versa.) Below is one method for translating English strings to Morse code. </p>

<pre><code>public static void StringtoMorse(String str){
    char Alphabet [] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' '};
    String MorseCode [] = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", "|"};


    for (int i = 0; i &lt; Alphabet.length; i ++){
        for (int j = 0; j &lt; str.length(); j ++){
            if (Alphabet[i] == (str.charAt(j))){
                System.out.print(MorseCode[i] + " ");
            }
        }
    }


}
</code></pre>

<p>For some cases, the program works: if I enter 'a', it returns '.-' correctly, but for some other cases, it doesn't work. Any tips?</p>