title: How to get values of exponential functions in java and how to code the exponential functions
body: <p>I want to get value of an exponential function to my code, but I don't know how to code to exponential functions in Java. What is the way to code exponential functions in Java?</p>
  
  <pre><code>public class Demo {
  
      // inputs are declared
      private int x[] = {1, 0, 1, 0};
      //weights are declared
      private double w[] = {0.4, 0.6, 0.7, 0.8};
      private double temp = 0;
  
      private double z = 0;
      private int desiredOutput[] = {0, 1, 1, 1};
  
      private double sigmoidOutput[] = {1, 1, 1, 1};
  
      public void calculate() {
          for(int i =0; i &lt; 4; i++) {
              temp = x[i] * w[i];
              z += temp;
          }
          /*
               I want to get the value of 1/(1+e to the power (-z) )
           */
      }
  
  }
  </code></pre>