Java Array Multiply mult(float[] nums, float n)

Here you can find the source of mult(float[] nums, float n)

Description

mult

License

Apache License

Declaration

public static float[] mult(float[] nums, float n) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static float[] mult(float[] nums, float n) {
        assert !Float.isInfinite(n) : "Trying to multiply " + Arrays.toString(nums) + " by  " + n; // Almost surely not what you want
        for (int i = 0; i < nums.length; i++)
            nums[i] *= n;//w w  w  . java2s .  c  o  m
        return nums;
    }

    public static double[] mult(double[] nums, double n) {
        assert !Double.isInfinite(n) : "Trying to multiply " + Arrays.toString(nums) + " by  " + n; // Almost surely not what you want
        for (int i = 0; i < nums.length; i++)
            nums[i] *= n;
        return nums;
    }

    public static String[] toString(long[] dom) {
        String[] result = new String[dom.length];
        for (int i = 0; i < dom.length; i++)
            result[i] = String.valueOf(dom[i]);
        return result;
    }

    public static String[] toString(int[] dom) {
        String[] result = new String[dom.length];
        for (int i = 0; i < dom.length; i++)
            result[i] = String.valueOf(dom[i]);
        return result;
    }
}

Related

  1. mult(double[][] A, double[][] B)
  2. mult(float[] nums, float n)
  3. multiply(byte[] a, byte b)
  4. multiply(double factor, double[] vector)
  5. multiply(double[] a, double m)