Program freezes while doing simple for loop
<p>this code:  </p>

<pre><code>class X {

    private char encryptChar(String input, int pos) {
        //do not worry about "lengtness" it's just for debugging purposes
        int length = keyString.length();//key string is "CD10"
        int pos_ = pos % keyString.length();
        char l_ = input.charAt(pos_);
        char r_ = keyString.charAt(pos_);
        int result = l_ ^ r_;
        char rr = (char) result;
        return (char) result;
    }

    public String encryptString(String message) {

        StringBuilder result = new StringBuilder();
        for (int i = 0; i &lt; message.length();++i) {
            result.append(encryptChar(message,i));//after one iteration this freezes! why?
        }
        return result.toString();
    }
}
</code></pre>

<p>See the comment two lines above.
O, and I'm using NetBeans 7.0.1</p>
