code: private double computeOutputError(double output, double[] gradient) {
  
          double error = 0.0;
          double out = outputLayer.output[0];
          double g = output - out;
  
          error += (0.5*g * g);
  
  
          gradient[0] = g;
  
          return error;
      }
docs: Compute the network output error.
  @param output the desired output.
  @param gradient the array to store gradient on output.
  @return the error defined by loss function.