This is a very bad idea. For large n (relative to to - from), dx will be so small that x += dx won't change the value of x, leaving you with a loop condition that will always be true, and you'll be stuck in the loop.
Do not use imprecise data (such as float and double) to control the flow of your program.
Instead, you should use an integer (e.g. ranging from 0 inclusive to n exclusive) to control the loop. There are a few ways to do it (and most of them are wrong when it comes to handling rounding errors), but at least you can be sure that your loop will terminate.
Regarding your question about invoke: I think f is a Method rather than a Field. java.lang.reflect is a set of classes for reflection. Using reflection, the programmer made it so that f points to a method, and invoke can be used to call that method. Since it's being invoked with null as the first argument (which would normally specify what this is), f must refer to some static method in order to succeed.