title: Best exception to throw inside a set method
body: <p>If I have a set method in which I want to modify some values,
  if an user enter wrong values which is the best exception to throw to indicate that failure?</p>
  
  <pre><code>public void setSomething(int d) throws ....
  {
      if (d &lt; 10 &amp;&amp; d &gt;= 0)
      {
          // ok do something
      }
      else throw new ... // throw some exception
  }
  </code></pre>