title: Is there a way to show the step by step computation of a calculation in Java?
body: <p>I am currently building an Android app that has a calculator that not only shows the result, but also shows how it reached that result?</p>
  
  <p>Is there any library or any way that I could show a step by step computation for the result of the code below?</p>
  
  <pre><code>int a = 5;
  int b = 6
  int c = 7;
  int d = 8;
  
  int result = a + (b * c) / d;
  </code></pre>
  
  <p>edit: By the way, it's a calculator for physics so I have lots of formulas. I'm using exp4j to parse a string formula as an expression. Here's a sample</p>
  
  <pre><code>//For formula velocity = (finalVelocity - initialVelocity) / time
  String formula1 = "(finalVelocity - initialVelocity) / time";
  Double result1 = new ExpressionBuilder(formula)
                       .variables("finalVelocity", "initialVelocity", "time")
                       .build()
                       .setVariable("finalVelocity", 4);
                       .setVariable("initialVelocity", 2);
                       .setVariable("time", 2)
                       .evaluate();
  //Sample Output
  //velocity = (4 - 2) / 2
  //velocity = 2 /2 
  //velocity = 1
  
  //For formula finalVelocity = (velocity * time) + initialVelocity
  String formula2 = "(velocity * time) + initialVelocity";
  Double result12 = new ExpressionBuilder(formula)
                       .variables("velocity", "time" "initialVelocity")
                       .build()
                       .setVariable("velocity", 4);
                       .setVariable("time", 2)
                       .setVariable("initialVelocity", 0)
                       .evaluate();
  //Sample Output
  //finalVelocity = (4 * 2) + 0
  //finalVelocity = 8 + 0
  //finalVelocity = 8
  </code></pre>
  
  <p>With many formulas, I'm trying to eliminate printing each step per formula. I'm trying to find a way to have a function that would print the steps for any formula.</p>