Dear Moazzam, and all,
Thank you very much for you initiative, and I appologize for the delay in replying to you. I was not checking my e-mail regularly in the past few weeks.
My main objective of porting the C code to Java was to build an azan application on my Java enabled Sony Ericsson K700i mobile, as well as to practice more and more my java skills which is only few months old.
I attached here the java code. As you may know, the code relies heavily on advanced trigonometric functions which are not available in the CLDC 1.1 of current mobile devices. So, the next challenge is to find a library developed by someone who can fill this gap. I looked around in several places, and did not find a library that satisfies my needs. I found a MathFP library, but then I discovered that it accepts integer values, while all the variables inside the prayer program are double.
By the way, I ran the java, and C code, and I found differences in the
results of both programs in the range of 2 to 3 minutes. Going through the debugger, I found out that this difference is coming from the accumulation of tiny differences between the results of the trigonometric functions in the C vs Java JVM. This is one more thing that I am not sure what to do about it.
And finaly, comparing the results of either the C or Java code to the one or two ready made prayer programs on my PC, again they are all different.
I live in Dubai, and in the past few months, I found that all the masjeeds have now installed an electronic clock that shows the 5 prayer times, according to which they operate. Again, I compared the values on their clock to any of the current program, and I found that they are different. So, I really do not know which is the most accurate program, or may be there is none at the moment.