How about using `java.lang.reflect.Array::getLength()` for this method and `getExpectedArrayLength`?