code: public static double optimalLinearFixedPoint(
        double[] data,
        int dataSize
    ) {
      if (dataSize == 0) {
        return 0;
      }
      if (dataSize == 1) {
        return Math.floor(0xFFFFFFFFl / data[0]);
      }
      double maxDouble = Math.max(data[0], data[1]);
  
      for (int i = 2; i < dataSize; i++) {
        double extrapol = data[i - 1] + (data[i - 1] - data[i - 2]);
        double diff = data[i] - extrapol;
        maxDouble = Math.max(maxDouble, Math.ceil(Math.abs(diff) + 1));
      }
  
      return Math.floor(0x7FFFFFFFl / maxDouble);
    }
docs: ///////////////////////////////////////////////////////////////////////////////