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 final int[] subtract(int[] a, int[] b) 

Method Source Code

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

public class Main {
    public static final int[] subtract(int[] a, int[] b) {
        int[] c = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            c[i] = a[i] - b[i];//from w ww  .  j  av a 2s  . com
        }
        return c;
    }

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

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

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

Related

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