I am working on a project which can solve optimization problems.I have written the whole application in java for desktop use, Now I want to convert it for android mobiles. So How can I call java files from php server to process the result and get back the result. Or I should completely implemented it in android locally.
I sudgest you to "rewrite" the code for android, even more considering that android applications are usually written in Java (even if you can speed them up using NDK in C/C++), so its porting should be straight forward.
For the sake of completeness, you can run external programs and retrive their result from PHP with the exec function: http://php.net/manual/en/function.exec.php
Hope I answered your question.