The other commenters are right that you are probably best off using a grammar library. If, however, this is a one off thing and you'd rather just deal with it quickly, this algorithm should handle it in a clear fashion, and will deal with nested parentheses. Note: I'm assuming your parentheses are well balanced, i.e., no right parentheses that don't have an opening left paren before them.
int parenDepth = 0;
int start = 0;
List<String> splits = new ArrayList<String>();
for(int i = 0; i < str.length(); i++)
{
char ch = str.get(i);
if(ch == '(')
parenDepth++;
else if(ch == ')')
parenDepth--;
else if(parenDepth == 0 && ch ==',')
{
if(start != i) // comment out this if if you want to allow empty strings in
// the splits
splits.add(str.substring(start, i));
start = i+1;
}
}
splits.add(str.substring(start));