It is usually ideal to have one thread per processor, under the premise that no other CPU-heavy applications are running on the system at the moment.
The rationale behind this is that switching between threads is a expensive operation (in relation), so the best way to use a multicore CPU efficiently is to avoid thread switching while still giving the CPU enough threads so that each core is utilized.
The number of CPU cores of the system can be obtained with
Runtime.getRuntime().availableProcessors();
On a system with hyper threading, this will give you the number of virtual CPUs, not physical ones. When you run one thread per virtual core instead of one per physical core, each thread might take a bit longer to complete, but overall they get more work done in the same time because the internal resources of the CPU can be used more efficiently. So you should run one per virtual core, unless it's important to you that each individual thread finishes as fast as possible (in that case you might consider to use single-threading, because multicore intel CPUs which execute a single thread overclock the core it is running on and switch it around between the cores so that the others can cool down).
For an application which you are going to ship to end-users, you might consider to use this value as a default, but allow them to change it, because the user might want to run your program in parallel with other CPU-intense applications. In that case they might want to reduce the number of threads spawned by your application to not slow down the others.