Java Array Fill fillArray(final float[] array, final float value)

Here you can find the source of fillArray(final float[] array, final float value)

Description

fill Array

License

Open Source License

Declaration

public static void fillArray(final float[] array, final float value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void fillArray(final float[] array, final float value) {
        int len = array.length;
        if (len > 0) {
            array[0] = value;//from w w  w.  j  a  v  a 2 s  . c om
        }

        for (int i = 1; i < len; i += i) {
            System.arraycopy(array, 0, array, i, ((len - i) < i) ? (len - i) : i);
        }
    }

    public static void fillArray(final int[] array, final int value) {
        int len = array.length;
        if (len > 0) {
            array[0] = value;
        }

        for (int i = 1; i < len; i += i) {
            System.arraycopy(array, 0, array, i, ((len - i) < i) ? (len - i) : i);
        }
    }
}

Related

  1. fill(T[][][] arr, T val)
  2. fillArray(byte[] btArray, byte[] btValue, int iStartPosition, int iLength, byte btAlternateValue, int iAlign)
  3. fillArray(byte[] data)
  4. fillArray(char[] array, int offset, char value)
  5. fillArray(double[][][] array, double[] value, int rows, int columns)
  6. fillArray(float filling, int length)
  7. fillArray(float[] batchVertices, float f)
  8. fillArray(int arrayLength)
  9. fillArray(int min, int max)