Returns the value of the indexed component in the specified array object, as a
long
.
Does not work with java.lang.Long:
package com.logicbig.example.array;
import java.lang.reflect.Array;
public class GetLongExample2 {
public static void main(String... args) {
Object o = new Long[]{1l, 4l, 9l};
long aLong = Array.getLong(o, 2);
System.out.println(aLong);
}
}
Output
Caused by: java.lang.IllegalArgumentException: Argument is not an array of primitive type
at java.base/java.lang.reflect.Array.getLong(Native Method)
at com.logicbig.example.array.GetLongExample2.main(GetLongExample2.java:15)
... 6 more