I am writing an application in java which involves parallel computing. My question is how can I explicitly assign threads to cores? What is the programming logic for it?
You cannot assign threads to cores.
Java7's fork/join framework addresses exactly the same problem. Automatically though (It will be designed for multi-core processors).
What you can do is to set Thread priority to prioritize your threads, if that's what you want to achieve.
JNI might be another direction to export, but an overkill I guess. You can look at Peter Lawrey's Java-Thread-Affinity which uses JNI (I haven't used it).