Java Array Divide div(float[] nums, int n)

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

Description

div

License

Apache License

Declaration

public static float[] div(float[] nums, int n) 

Method Source Code

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

import java.util.*;

public class Main {
    public static float[] div(float[] nums, int n) {
        for (int i = 0; i < nums.length; i++)
            nums[i] /= n;//from   w w  w.jav a2s  . c o m
        return nums;
    }

    public static float[] div(float[] nums, float n) {
        assert !Float.isInfinite(n) : "Trying to divide " + 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 double[] div(double[] nums, double n) {
        assert !Double.isInfinite(n) : "Trying to divide " + 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. div(double a, double[] b)
  2. div(final int[] result, final int[] vector, final int[] scale)
  3. div(float[] items, int offset, int length, float divisor)
  4. div(float[] items, int offset, int length, float divisorX, float divisorY)
  5. div(float[] nums, float n)
  6. div(float[] nums, int n)
  7. div(float[] values, float divisor)
  8. div(int[]... vectors)
  9. div(String[] X)