Class IntegerUtil

java.lang.Object
org.seasar.doma.internal.util.IntegerUtil

public final class IntegerUtil extends Object
  • Constructor Details

    • IntegerUtil

      public IntegerUtil()
  • Method Details

    • nextPowerOfTwo

      public static int nextPowerOfTwo(int n)
      Computes the next power of two greater than or equal to the given integer. If the input is already a power of two, the method returns the same value. If the computation results in an overflow, the input value is returned instead.
      Parameters:
      n - the integer input, must be greater than or equal to 0
      Returns:
      the next power of two greater than or equal to the input value
      Throws:
      IllegalArgumentException - if the input value is less than 0