Android examples for java.lang:Array Element
multiplies each element of the passed double array with itself
//package com.java2s; public class Main { /**/*from w w w . ja v a 2s.com*/ * multiplies each element of the passed double array * with itself * @param _a the array to square * @return an array containing squared values of the passed array */ public static double[] square(double[] _a) { return multiply(_a, _a); } /** * multiplies two passed double arrays element by element * @param _a the first array * @param _b the second array * @return an array containing the element wise multiplication * of the passed arrays */ public static double[] multiply(double[] _a, double[] _b) { double[] res = new double[_a.length]; for (int i = 0; i < res.length; i++) { res[i] = _a[i] * _b[i]; } return res; } }