0

I was trying to add some more code in the following MathContext

 private static MathContext mc = new MathContext( 12, RoundingMode.HALF_EVEN );

This is the code I was trying to put in the context

footToMeter = footToMeter.multiply(METER_TO_INTL_FOOT_FACTOR);

    if(footToMeter.signum() >= 0.07)
        {
    return footToMeter =METER_TO_INTL_FOOT_FACTOR.setScale(12,RoundingMode.UP);
        }
    else if(footToMeter.signum() < 0.07);
        {
    return   footToMeter = footToMeter.setScale(12, RoundingMode.DOWN); 
        }
 }

I would love the rounding function to have in the MathContext.

Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0