code: public static double[] subtractArray(double[] array1, double[] array2)
      {
          if (array1.length != array2.length)
          {
              throw new IllegalArgumentException("The dimensions have to be equal!");
          }
  
          double[] result = new double[array1.length];
          assert array1.length == array2.length;
          for (int i = 0; i < array1.length; i++)
          {
              result[i] = array1[i] - array2[i];
          }
  
          return result;
      }
docs: 配列の各要素の減算を行う。
  
  @param array1 配列1
  @param array2 配列2
  @return (配列1 - 配列2)の結果配列