You would use something like this:
if (aField.getType().isArray()) { Object array = aField.get(obj); int length = Array.getLength(array); for (int i = 0; i < length; i++) { System.out.println(Array.get(array, i)); } }
In other words, you first retrieve the value from the field using Field.get , and then use the java.lang.reflect.Array helper class to access the length and individual elements.
Jon skeet
source share