Java Array Multiply multiplyValues(byte[] array, int multiplier)

Here you can find the source of multiplyValues(byte[] array, int multiplier)

Description

Multiply all values in the given array with the multiplier.

License

Open Source License

Parameter

Parameter Description
array a parameter
multiplier a parameter

Return

Cloned version of the array. Not same object!

Declaration

public static byte[] multiplyValues(byte[] array, int multiplier) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*w ww  .j av  a  2 s  .c  om*/
     * Multiply all values in the given array with the multiplier.
     * @param array
     * @param multiplier
     * @return Cloned version of the array. Not same object!
     */
    public static byte[] multiplyValues(byte[] array, int multiplier) {

        byte[] newArray = new byte[array.length];
        for (int i = 0; i < array.length; i++) {
            newArray[i] = (byte) (array[i] * multiplier);
        }
        return newArray;
    }
}

Related

  1. multiplyScalar(double[] a, double value)
  2. multiplyScalarInPlace(double[] a, double value)
  3. multiplySelf(double[] dest, double source)
  4. multiplySparse(int[][][] as, int A, int[][][] bs, int B, int[][][] cs)
  5. multiplySquares(float[] mat1, float[] mat2, int sidelength)
  6. multiplyVecorWithScalar(double[] v, double s)
  7. multiplyVector(float[] mat, float[] vec, float[] dest)
  8. multiplyVectorByMatrix(double[] v, double[] m, double[] result)
  9. multiplyX(long[] x, long[] z)