title: Is it possible to pass arithmetic operators to a method in java?
body: <p>Right now I'm going to have to write a method that looks like this:</p>
  
  <pre><code>public String Calculate(String operator, double operand1, double operand2)
  {
  
          if (operator.equals("+"))
          {
              return String.valueOf(operand1 + operand2);
          }
          else if (operator.equals("-"))
          {
              return String.valueOf(operand1 - operand2);
          }
          else if (operator.equals("*"))
          {
              return String.valueOf(operand1 * operand2);
          }
          else
          {
              return "error...";
          }
  }
  </code></pre>
  
  <p>It would be nice if I could write the code more like this:</p>
  
  <pre><code>public String Calculate(String Operator, Double Operand1, Double Operand2)
  {
         return String.valueOf(Operand1 Operator Operand2);
  }
  </code></pre>
  
  <p>So Operator would replace the Arithmetic Operators (+, -, *, /...)</p>
  
  <p>Does anyone know if something like this is possible in java?</p>