multiply Array By Const - Java Collection Framework

Java examples for Collection Framework:Array Algorithm

Description

multiply Array By Const

Demo Code


//package com.java2s;

public class Main {


    public static double[] multiplyArrayByConst(double[] array,
            double constant) {
        double[] arr_copy = array.clone();

        for (int i = 0; i < array.length; i++) {
            arr_copy[i] = (double) arr_copy[i] * constant;
        }/*from  w  w w  .ja v  a  2  s  . c  o  m*/
        return arr_copy;
    }
}

Related Tutorials