code: @Override
      public int predict(double[] x, double[] y) {
          setInput(x);
          propagate();
          getOutput(y);
  
          if (outputLayer.units == 1) {
              if (outputLayer.output[0] > 0.5) {
                  return 0;
              } else {
                  return 1;
              }
          }
  
          double max = Double.NEGATIVE_INFINITY;
          int label = -1;
          for (int i = 0; i < outputLayer.units; i++) {
              if (outputLayer.output[i] > max) {
                  max = outputLayer.output[i];
                  label = i;
              }
          }
          return label;
      }
docs: Predict the target value of a given instance. Note that this method is NOT
  multi-thread safe.
  @param x the instance.
  @param y the array to store network output on output. For softmax
  activation function, these are estimated posteriori probabilities.
  @return the predicted class label.