how to round off if the value is 1.01 to 1, if 1.1 then 2 in java?
<p>In java</p>

<p>How to roundoff a value(either float, bigdecimal or double) having the following pattern,</p>

<p>(1) If the value is 1.0, i.e., if the decimal is started with zero then this should not rounded off and the value should be the whole number. ie., in this case "1".</p>

<p>(2) If the value is 1.1 i.e., if the decimal place started with number greater than 0, then the whole number should be rounded to the next number. i.e., if 1.1 then it should be 2.</p>