Java examples for java.util:Arrays
Fill 10-element array with 7s
import java.util.Arrays; public class Main { public static void main(String[] args) {//from w w w. j a v a 2 s. c o m // fill 10-element array with 7s int[] filledIntArray = new int[10]; Arrays.fill(filledIntArray, 7); displayArray(filledIntArray, "filledIntArray"); } // output values in each array public static void displayArray(int[] array, String description) { System.out.printf("%n%s: ", description); for (int value : array) System.out.printf("%d ", value); } }