Java Array Fill fillArray(char[] array, int offset, char value)

Here you can find the source of fillArray(char[] array, int offset, char value)

Description

Fills part of the array with a value.

License

Open Source License

Declaration

public static void fillArray(char[] array, int offset, char value) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  w ww .j a  va2 s  .  c om*/
     * Fills part of the array with a value.
     */
    public static void fillArray(char[] array, int offset, char value) {

        int to = array.length;

        while (--to >= offset) {
            array[to] = value;
        }
    }

    /**
     * Fills part of the array with a value.
     */
    public static void fillArray(byte[] array, int offset, byte value) {

        int to = array.length;

        while (--to >= offset) {
            array[to] = value;
        }
    }

    /**
     * Fills the array with a value.
     */
    public static void fillArray(Object[] array, Object value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }

    /**
     * Fills the int array with a value
     */
    public static void fillArray(int[] array, int value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }

    /**
     * Fills the double array with a value
     */
    public static void fillArray(double[] array, double value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }

    /**
     * Fills the int array with a value
     */
    public static void fillArray(boolean[] array, boolean value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }
}

Related

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