我正在尝试使用仿射方法,但我的输出完全错误,我不知道如何修复它,任何人都可以看看它并告诉我出了什么问题
public void Affine(int a, int b){
StringBuilder builder = new StringBuilder();
int len = jMesaj.getText().length(); //length of the input
for (int i = 0; i < len; i++){
char currentChar = jMesaj.getText().charAt(i);
char finalChar = ((char)(currentChar +(a*i + b)% 26));
builder.append(finalChar);
}
String result = builder.toString();
builder.delete( 0 , builder.length() -1 );
jEncryptionResult.setText(result); //display result in jTextArea
}