code: public static void validateCnnKernelStridePadding(int[] kernelSize, int[] stride, int[] padding) {
          if (kernelSize == null || kernelSize.length != 2) {
              throw new IllegalStateException("Invalid kernel size: expected int[] of length 2, got "
                      + (kernelSize == null ? null : Arrays.toString(kernelSize)));
          }
  
          if (stride == null || stride.length != 2) {
              throw new IllegalStateException("Invalid stride configuration: expected int[] of length 2, got "
                      + (stride == null ? null : Arrays.toString(stride)));
          }
  
          if (padding == null || padding.length != 2) {
              throw new IllegalStateException("Invalid padding configuration: expected int[] of length 2, got "
                      + (padding == null ? null : Arrays.toString(padding)));
          }
  
          if (kernelSize[0] <= 0 || kernelSize[1] <= 0) {
              throw new IllegalStateException(
                      "Invalid kernel size: values must be positive (> 0) for all dimensions. Got: "
                              + Arrays.toString(kernelSize));
          }
  
          if (stride[0] <= 0 || stride[1] <= 0) {
              throw new IllegalStateException(
                      "Invalid stride configuration: values must be positive (> 0) for all dimensions. Got: "
                              + Arrays.toString(stride));
          }
  
          if (padding[0] < 0 || padding[1] < 0) {
              throw new IllegalStateException(
                      "Invalid padding configuration: values must be >= 0 for all dimensions. Got: "
                              + Arrays.toString(padding));
          }
      }
docs: Perform validation on the CNN layer kernel/stride/padding. Expect 2d int[], with values > 0 for kernel size and
  stride, and values >= 0 for padding.
  
  @param kernelSize Kernel size array to check
  @param stride     Stride array to check
  @param padding    Padding array to check