See below.
After the for loop,
azBuffer
contains the alphabetic characters in their original order,
but converted to lower case.
Blanks and punctuation have been skipped.
Now do this:
forward based on azBuffer.azBuffer.backward based on the reversed azBuffer.
This can be done in two statements, using methods of StringBuffer.
Fill in the blanks.