Example usage for java.util Arrays fill

List of usage examples for java.util Arrays fill

Introduction

In this page you can find the example usage for java.util Arrays fill.

Prototype

public static void fill(Object[] a, int fromIndex, int toIndex, Object val) 

Source Link

Document

Assigns the specified Object reference to each element of the specified range of the specified array of Objects.

Usage

From source file:Main.java

public static void main(String[] args) {
    int[] integer = new int[10];
    System.out.println(Arrays.toString(integer));
    Arrays.fill(integer, 1, 4, 5);
    System.out.println(Arrays.toString(integer));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    int[] intArr = new int[10];
    int intFillValue = 1;

    Arrays.fill(intArr, startIndex, endIndex, intFillValue);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    long[] longArr = new long[10];
    long longFillValue = 1;

    Arrays.fill(longArr, startIndex, endIndex, longFillValue);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    byte[] byteArr = new byte[10];
    byte byteFillValue = 1;

    Arrays.fill(byteArr, startIndex, endIndex, byteFillValue);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    char[] charArr = new char[10];
    char charFillValue = 1;

    Arrays.fill(charArr, startIndex, endIndex, charFillValue);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;
    double[] doubleArr = new double[10];
    double doubleFillValue = 1;
    Arrays.fill(doubleArr, startIndex, endIndex, doubleFillValue);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    float[] floatArr = new float[10];
    float floatFillValue = 1;

    Arrays.fill(floatArr, startIndex, endIndex, floatFillValue);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    short[] shortArr = new short[10];
    short shortFillValue = 1;

    Arrays.fill(shortArr, startIndex, endIndex, shortFillValue);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    int startIndex = 0;
    int endIndex = 4;

    String[] stringArr = new String[10];
    String stringFillValue = "1";

    Arrays.fill(stringArr, startIndex, endIndex, stringFillValue);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int startIndex = 0;
    int endIndex = 4;

    boolean[] booleanArr = new boolean[10];
    boolean booleanFillValue = true;

    Arrays.fill(booleanArr, startIndex, endIndex, booleanFillValue);

}