Utilities.getDistance(uni, enemyuni) <= uni.getAttackRange()
Yes, it's valid - it will promote the
int to a
double before performing the comparison.
From the latter:
Widening primitive conversion (§5.1.2) is applied to convert either or both operands as specified by the following rules:
If either operand is of type double, the other is converted to double.