2

在执行期间,该方法被调用并且整数i显示为0屏幕上。但是,for 循环内部没有输出,表明 for 循环没有执行。我还用断点对此进行了测试,并获得了相同的结果。任何帮助表示赞赏。

private void decrypt_btnActionPerformed(java.awt.event.ActionEvent evt) {
    int ciphertext_length = Ciphertext().length();
    String decrypted_char = "";
    int i = 0;

    System.out.println("increment" + i);    

    try {
        for (i = 0; i == ciphertext_length; i++) {

            System.out.println("test" + i);

            String cipher_current_char = getLetterAtIndex(Ciphertext(), i);
            int pos_char_in_alphabet = getIndexAtLetter(Alphabet(), cipher_current_char);

            decrypted_char = decrypted_char +
                getLetterAtIndex(Alphabet(), pos_char_in_alphabet - 5);

            status_label.setText(100 / i + "%");
        }
    } catch (Exception e) {
        e.getMessage();
    }

    plain_ta.setText(decrypted_char);
}
4

1 回答 1

7
  for (i = 0; i==ciphertext_length; i++){

很可能应该是

  for (i = 0; i<ciphertext_length; i++){
于 2013-01-21T03:25:42.500 回答