Most elegant way to apply an operator found as a string in java?
<p>Potentially dumb:
Assuming I have a string containing an operator what's the best way to apply this operator ? </p>

<p>What i tend to do is :</p>

<pre><code>if(n.getString(1).equals("&lt;&lt;")) {
  result = tmp1 &lt;&lt; tmp2;
}
</code></pre>

<p>for each kind of operator I have. Is there a better way ? </p>
