Fill Elements in a short type Array in Java
Description
The following code shows how to fill Elements in a short type Array.
Example
// w w w.java 2 s . c o m
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
short[] shortArr = new short[10];
short shortFillValue = 2;
Arrays.fill(shortArr, shortFillValue);
System.out.println(Arrays.toString(shortArr));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »