Java Array Subtract subtract(int a, int[] b)

Here you can find the source of subtract(int a, int[] b)

Description

subtract

License

Apache License

Declaration

public static int[] subtract(int a, int[] b) 

Method Source Code

//package com.java2s;
/**//  www .ja v  a 2s  .  co  m
 * 
 *    Copyright 2017 Florian Erhard
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * 
 */

public class Main {
    public static int[] subtract(int a, int[] b) {
        int[] re = new int[b.length];
        for (int i = 0; i < b.length; i++)
            re[i] = a - b[i];
        return re;
    }
}

Related

  1. subtract(final double[] first, final double[] second)
  2. subtract(final double[] v1, final double[] v2)
  3. subtract(final double[] vector1, final double[] vector2)
  4. subtract(float a[][][], float b[][][])
  5. subtract(float[] dividend, float[] divisor)
  6. subtract(int bytesPerDim, int dim, byte[] a, byte[] b, byte[] result)
  7. subtract(int[] a, int[] b)
  8. subtract2(double[] v1, double[] v2, double[] res)
  9. subtractArray(double[] array1, double[] array2)