title: Rounding a Java BigDecimal to the nearest interval
body: <p>I have a BigDecimal calculation result which I need to round to the nearest specified interval (in this case it's the financial market tick size).</p>
  
  <p>e.g. Price [Tick Size] -> Rounded Price</p>
  
  <pre><code>100.1 [0.25] -&gt; 100
  100.2 [0.25] -&gt; 100.25
  100.1 [0.125] -&gt; 100.125
  100.2 [0.125] -&gt; 100.25
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>Update: schnaader's solution, translated into Java/BigDecimal terms:</p>
  
  <pre><code>price = price.divide(tick).setScale(0, RoundingMode.HALF_UP).multiply(tick)
  </code></pre>