Java Array Multiply multiply(float[] array, float factor)

Here you can find the source of multiply(float[] array, float factor)

Description

Multiplies all entries of array by factor.

License

Open Source License

Parameter

Parameter Description
array the array
factor the number used for multiplication.

Declaration

public static float[] multiply(float[] array, float factor) 

Method Source Code

//package com.java2s;
/*/*from   w  w  w  . j a  v  a2  s.c o  m*/
 * Copyright (C) 2010-2014  Andreas Maier
 * CONRAD is developed as an Open Source project under the GNU General Public License (GPL).
*/

public class Main {
    /**
     * Multiplies all entries of array by factor.
     * @param array the array
     * @param factor the number used for multiplication.
     */
    public static float[] multiply(float[] array, float factor) {
        for (int i = 0; i < array.length; i++) {
            array[i] *= factor;
        }
        return array;
    }

    /**
     * Multiplies all entries of the two arrays element by element.<bR>
     * Works in place and overwrites array.
     * @param array the array
     * @param array2 the other array.
     */
    public static void multiply(float[] array, float[] array2) {
        for (int i = 0; i < array.length; i++) {
            array[i] *= array2[i];
        }
    }
}

Related

  1. multiply(final double[] lhs, final double[] rhs)
  2. multiply(final double[] v1, final double[] v2)
  3. multiply(final double[] x, final double[] y)
  4. multiply(final float[] complexA, final float[] complexB, final boolean overwriteA)
  5. multiply(final int[] numbers)
  6. multiply(float[] array, int multiplier)
  7. multiply(float[] in, float f)
  8. multiply(float[] mat, float[] mat2, float[] dest)
  9. multiply(float[] v, double factor)