code: private void backpropagate(Layer upper, Layer lower) {
          for (int i = 0; i <= lower.units; i++) {
              double out = lower.output[i];
              double err = 0;
              for (int j = 0; j < upper.units; j++) {
                  err += upper.weight[j][i] * upper.error[j];
              }
              lower.error[i] = out * (1.0 - out) * err;
          }
      }
docs: Propagates the errors back from a upper layer to the next lower layer.
  @param upper the lower layer where errors are from.
  @param lower the upper layer where errors are propagated back to.