Hello, I want to take a math average of Filed (this.javaClass.fields.getShort for example). How can I do it?
Did you mean you want to get an average of the values of those fields? Then you just need to get values and average them:
this.javaClass.fields.map { field -> field.getShort(this) }.average()
If not every field is Short, you might want to get its value as Number and convert it to double then: (field.get(this) as Number).toDouble()
instead of field.getShort(this)
1 Like
yes, thanks