You can make use of multiple cores using multiple threads. But using a higher number of threads than the number of cores present in a machine can simply be a waste of resources. You can use availableProcessors() to get the number of cores.
In Java 7 there is fork/join framework to make use of multiple cores.
Related Questions:
- Is Multi-Threaded algorithm required to make use of Multi-core processors ?
- Threads per Processor
- Correctly multithreaded quicksort or mergesort algo in Java?