title: Java solving mathematical operations from strings
body: <p>I have strange task to do in Java.
  Without using any loops and if statements i have to develop simple calculator which defines all operations and numbers in one String like: "126.7214        +  121"
  I used regex to parse string and get 3 string variables ['125.7214', '+' ,'121'], normally i would do if statement, parseString to integer and do if statement based on math symbol to sum those numbers, but I cant. Is there any trick in Java to do it faster? Some ready-to go library?
  I would appreciate any advice. :code:</p>
  
  <pre><code>import java.math.BigDecimal;
  import java.math.RoundingMode;
  import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  
  public class Calc {
  
      public String doCalc(String cmd) {
  
          Matcher m = Pattern.compile("\\S+").matcher(cmd);
          m.find();
          String num1= m.group(0);
          m.find();
          String znak = m.group(0);
          m.find();
          String num2 = m.group(0);
  
  
  
  
  
          return result;
      }
  }  
  </code></pre>