Java Array Subtract subtract(double[] values, double value)

Here you can find the source of subtract(double[] values, double value)

Description

Subtracts a value from every value in the array

License

Open Source License

Parameter

Parameter Description
values collection of values
value a value to be subtracted

Declaration

public static double[] subtract(double[] values, double value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  ww  w.  jav a2  s.  c  o m*/
     * Subtracts a value from every value in the array
     * @param values collection of values
     * @param value a value to be subtracted
     * @return
     */
    public static double[] subtract(double[] values, double value) {
        double[] result = new double[values.length];
        for (int i = 0; i < values.length; i++) {
            result[i] = values[i] - value;
        }
        return result;
    }
}

Related

  1. subtract(double[] first, double[] second)
  2. subtract(double[] first, double[] second, double[] out)
  3. subtract(double[] flowFrom, double[] flowTo)
  4. subtract(double[] p1, double[] p2)
  5. subtract(double[] res, double[] subtractor)
  6. subtract(double[] x, double c)
  7. subtract(double[][] a, double[][] b)
  8. subtract(double[][] a, double[][] b)
  9. subtract(double[][] dest, double[][] a, double[][] b)