Yes, the same approach that exists in FORTRAN, C, Perl, etc: coding up the math.
To be less blithe: Java is not the typical language choice for people doing numerics, and it wasn't written to cater to that audience, so the intrinsic language support isn't great, nor is the library support. My recommendation: pick a language explicitly for your problem - e.g., R, Octave, Matlab, Mathematica, Maple - or one that has more baked-in + ongoing community support - e.g., C/C++, FORTRAN, Perl.
That said, there are some libraries if you are committed to doing numerics in Java; NIST has best gathering I've found, but that site seems under-maintained, so it's only a starting point.
Is there a general approach to such mathematical problem using Java
There is, it's just a question of how much more work it will be compared to other math-centric languages. – David B