Class IntUtils


  • public class IntUtils
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  IntUtils.Round  
    • Constructor Summary

      Constructors 
      Constructor Description
      IntUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int roundToPrecision​(double value, IntUtils.Round round, int precision)
      Rounds a value to a defined precision.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntUtils

        public IntUtils()
    • Method Detail

      • roundToPrecision

        public static int roundToPrecision​(double value,
                                           IntUtils.Round round,
                                           int precision)
        Rounds a value to a defined precision.

        Example: roundToPrecision(1234, Round.AWAY_FROM_ZERO, 100) -> 1300

        Parameters:
        value - the value
        round - the rounding mode
        precision - the decimal precision
        Returns:
        the rounded value