I find some bug at "Simple text encryption and decryption" program
Hellow everybody. I find some bug at "Simple text encryption and decryption" program posted by SoloLearn. If you try to change "This is awesome" to String text="____"; for instance the code generates ArrayIndexOutOfBoundsException. In case of String text ="\"\"\"'; the string is ofset only with 4, no 5. This is true about all symbols in the end of tample array. I thing the loop at row 38 must be change from if (j <= chars.length - offset) { to if (j < chars.length - offset) { and most immportant the encrypting formula at row 45 plain[i] = chars[j - (chars.length - offset + 1)]; to plain[i] = chars[j - (chars.length - offset )]; and correspondly the decrypting formula at row 62 from cipher[i] = chars[(chars.length - offset +1) + j]; to cipher[i] = chars[(chars.length - offset ) + j]; These changes fix the problem in my view. Sorry for my not fulent english, I hope that SoloLearn will answer here.