I have the following class:
public class GeneralClass
{
public int x;
public int[] arr = new int[3];
}
And the following logic:
public void loadClass(Class cls) {
Field[] fields = cls.getDeclaredFields();
for (Field field : fields) {
if (field.getType().isArray()) {
// How can I print the array length ?
}
}
}
How can I know what is the size (length) of the array ?