code: public double[] Kernel1D(int size) {
          if (((size % 2) == 0) || (size < 3) || (size > 101)) {
              try {
                  throw new Exception("Wrong size");
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
          int r = size / 2;
          // kernel
          double[] kernel = new double[size];
  
          // compute kernel
          for (int x = -r, i = 0; i < size; x++, i++) {
              kernel[i] = Function1D(x);
          }
  
          return kernel;
      }
docs: 1-D Gaussian kernel.
  
  @param size Kernel size (should be odd), [3, 101].
  @return Returns 1-D Gaussian kernel of the specified size.