Class Rounder

java.lang.Object
is.codion.common.Rounder

public final class Rounder extends Object
A utility class for rounding doubles.
  • Method Details

    • roundDouble

      public static Double roundDouble(Double d, int places)
      Rounds the given double to places decimal places, using RoundingMode.HALF_UP.
      Parameters:
      d - the double to round, null results in a null return value
      places - the number of decimal places
      Returns:
      the rounded value or null if the parameter value was null
    • roundDouble

      public static Double roundDouble(Double d, int places, RoundingMode roundingMode)
      Rounds the given double to places decimal places.
      Parameters:
      d - the double to round, null results in a null return value
      places - the number of decimal places
      roundingMode - the rounding mode
      Returns:
      the rounded value or null if the parameter value was null