title: Why is my java code only using about 20% of CPU when there is no GUI
body: <p>I am doing a java program which has two versions : one with a GUI and one without. </p>
  
  <p>I am happy with the GUI one because it uses 100% of the CPU all the time but the one without (which is supposed to be faster) only uses 5-25% of the CPU. Both versions are exactly the same in terms of computations. The same problem happens when I run from Eclipse and from the shell.</p>
  
  <p>I thought about allocating more memory with -Xms and -Xmx but it won't change the CPU usage.</p>
  
  <p>I also tried to set the priority to nice my process to -15 in terminal but there was no noticeable difference.</p>
  
  <p>How can I ensure, in Eclipse and in terminal that my code has 100% of the CPU.</p>