I’ve written the following, but Java doesn’t like it!
int limit = Math.round(Math.sqrt(inputNumber));
Suggestions from my IDE are to add a cast of (int) to the right hand side, but I was under the impression that Math.round would format the number into an integer anyway?
Math.sqrt(x)returns adouble. There are several overloadedMath.roundfunctions. The one that takes adoubleas the argument returns along, not anint.