My, that code is badly formatted.
You should spread it out. You had your cases all squashed together on one line where they are difficult to read. It should have looked like this:-
You should always add a comment whenever you have fallthrough in a switch otherwise people reading the code will assume you have made a mistake and add break; statements.
The reason for the Exception is that you declared a 4‑element array and only filled 3 of its spaces; sa[3] remains as null. One way to get rid of the null is to change the declaration to declaration and initialisation with an array initialiser. Your code will now look like this:-
Look at line 4. Note you only get one line of output. I shall leave you to work out what it is.
In future use spaces not tabs for indenting, and use some whitespace. o+="g" is difficult to read whereas o += "g" is much easier.