The string builder doesn't have anything in it, you don't initialize the string builder with the string you want. You need to do something like this:
StringBuilder builder = new StringBuilder(string);
Otherwise builder is an empty string, so when you try to delete out of it, there is nothing there and it throws an exception. Apologies if the above does not compile, I'm not a Java programmer.