Java Array Divide divideArrayElements(final int[] array, final int divisor)

Here you can find the source of divideArrayElements(final int[] array, final int divisor)

Description

Average an int array elements with divisor.

License

Open Source License

Parameter

Parameter Description
array a parameter
divisor a parameter

Declaration

public static double[] divideArrayElements(final int[] array,
        final int divisor) 

Method Source Code

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

public class Main {
    /**//from  w ww. j a  v  a  2 s .  c  om
     * Average an int array elements with divisor.
     *
     * @param array
     * @param divisor
     * @return
     */
    public static double[] divideArrayElements(final int[] array,
            final int divisor) {
        final double[] averaged = new double[array.length];
        for (int i = 0; i < averaged.length; i++) {
            averaged[i] = ((double) array[i]) / divisor;
        }
        return averaged;
    }
}

Related

  1. divide(long[] array, double value)
  2. divideAbsolute(double[] one, double[] two)
  3. divideAndConquer(int[] array, int num)
  4. divideArray(float[] array, float num)
  5. divideArray(T[] arr, Integer... cuts)
  6. divideBytearrays(byte[] ret, int headerLength, byte[] bArr)
  7. divideByteArrayToChunks(byte data[], int chunkSize)
  8. divideElements(double[] v1, double[] v2, double[] rs)
  9. divideElements(final int j, final int numRows, final double[] u, final int startU, final double realA, final double imagA)