[ask] how to use an array of double in Java Processing

Here’s my own take on @tavisena’s converted sketch; this time using a unified 3D array: :star_struck:

final double[][][] params = { // [6]x[6]x[]

// Discourse.Processing.org/t/
// ask-how-to-use-an-array-of-double-in-java-processing/2908/21

// Modded by GoToLoop (2018-Aug-24)

void setup() {
  println("Result:", calculate(params));
  exit();
}

static final int calculate(final double[][][] arr3d) {
  final int size = arr3d.length, nums[] = new int[4];
  final double[] sfs = new double[size];

  for (int i = 0; i < size; ++i) {
    final double[][] arr2d = arr3d[i];

    for (int len = arr2d[i].length, j = 0; j < len; ++j)
      sfs[i] +=
        (arr2d[0][j] * arr2d[1][j] *
        (arr2d[2][j] + arr2d[3][j]) *
        arr2d[4][j]) + arr2d[5][j];
  }

  ++nums[sfs[0] > 0? 0 : 1];
  ++nums[sfs[1] > 0? 0 : 2];
  ++nums[sfs[2] > 0? 0 : 3];
  ++nums[sfs[3] > 0? 1 : 2];
  ++nums[sfs[4] > 0? 1 : 3];
  ++nums[sfs[5] > 0? 2 : 3];

  int max = 0, result = 0;

  for (int i = 0; i < 4; ++i) {
    final int n = nums[i];

    if (n > max) {
      max = n;
      result = i + 1;
    }
  }

  printArray(nums);
  println("\nMax:", max);

  return result;
}