Java Array Subtract arraySubtract(final Double[] first, final Double[] second)

Here you can find the source of arraySubtract(final Double[] first, final Double[] second)

Description

Subtracts the elements of the arrays.

License

Apache License

Parameter

Parameter Description
first First array: a
second Second array: b

Return

new array with elements e: e_i = a_i - b_i

Declaration

public static Double[] arraySubtract(final Double[] first, final Double[] second) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from   w  ww .j av  a  2  s.  c  om
     * Subtracts the elements of the arrays.
     *
     * @param first  First array: a
     * @param second Second array: b
     * @return new array with elements e: e_i = a_i - b_i
     */
    public static Double[] arraySubtract(final Double[] first, final Double[] second) {
        final Double[] toret = new Double[first.length];
        for (int i = 0; i < first.length; i++) {
            toret[i] = first[i] - second[i];
        }
        return toret;
    }
}

Related

  1. arraySubtract(double[] x1, double[] x2)
  2. subtract(byte[] a, byte[] b)
  3. subtract(double[] a, double[] b)
  4. subtract(double[] a, double[] b)
  5. subtract(double[] a, double[] b)