Brandon Peeples wrote:"" + s1.charAt(i);
Please use String.valueOf(s1.charAt(i)) instead. The code you used will use that call in the background, but will also create a StringBuilder:
By using String.valueOf directly you will save that one object. Maybe this is micro-optimization, but using these little API calls is still a good idea.
Just one other question: why do you need your call to be recursive? I can find one way that runs not in
O(m * n) with m being the length of the first string and n being the length of the second string*, but in O(k log k) with k being the maximum of m and n. It involves converting the two arrays into character arrays (O(k)), sorting these (O(k log k)), then comparing the two arrays for equality (O(k)). All you will then need is a handful of API calls, most from String, the others from java.util.Arrays. The complete program will run with just 9 method calls, 4 of which are your calls for changing the strings into lower case and removing spaces.
* In your code you loop over m, inside that loop you loop over n.