Use Array.setShort and Array.setLong in Java
Description
The following code shows how to use Array.setShort and Array.setLong.
Example
/*from w w w. j ava 2 s. co m*/
import java.lang.reflect.Array;
public class Main {
public static void main(String... args) {
Object o = new int[2];
Array.setShort(o, 0, (short) 2); // widening, succeeds
Array.setLong(o, 1, 2L); // narrowing, fails
}
}