title: java method for parsing nested expressions
body: <p>lets say I've written a function to evaluate a simple mathematical operation, and I have some user input in a string such as:
  "1 + [2 + [3+4]]"
  How can I parse these square brackets and extract first the inner-most text (3+4), evaluate it, then parse the outer braces (2 + 7)?
  I have a rudimentary understanding of Regex search and replace, but I know they won't do recursion like this.
  I'd like some basic java code to do this, not yet another jar/API if I can avoid it.</p>