Is the error during compilation, or during execution?
What is the error message?
Taking a quick look at the code--and maybe I am mistaken--but the closing brace on line 28 seems to match the opening brace for the for loop on line 24. Or is that for the if statement on line 22?
As a first step, double-check to see all your closing braces are where they should be.