title: Round double to number in interval, defining by step
body: <p>I have some abstract double interval, defining by step f.e.:</p>
  
  <p><code>0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 - where interval == 0.1</code></p>
  
  <p><code>0.0, 0.25, 0.5, 0.75, 1.0 - where interval == 0.25</code></p>
  
  <p><code>0.0, 0.5, 1.0 - where interval == 0.5</code></p>
  
  <p>Does Java have some instrument to "round" some double to closest number, according to interval? f.e:</p>
  
  <p><code>0.511111 - to 0.5</code> in first case</p>
  
  <p><code>0.599999 - to 0.6</code> in first case</p>
  
  <p><code>0.511111 - to 0.5</code> in second case</p>
  
  <p><code>0.599999 - to 0.5</code> in second case</p>
  
  <p><code>0.711111 - to 0.75</code> in second case</p>
  
  <p><code>0.744444 - to 0.5</code> in third case</p>
  
  <p><code>0.755555 - to 1.0</code> in third case</p>
  
  <p><code>0.92222 - to 1.0</code> in third case</p>