Class IntegerMath

java.lang.Object
com.comphenix.protocol.utility.IntegerMath

public final class IntegerMath extends Object
  • Field Details

    • MAX_SIGNED_POWER_OF_TWO

      public static final int MAX_SIGNED_POWER_OF_TWO
      See Also:
  • Method Details

    • nextPowerOfTwo

      public static int nextPowerOfTwo(int x)
      This calculates the smallest y for which 2^y > x
      Parameters:
      x - the number that the next power of 2 should be calculated for.
      Returns:
      If the next power of two would be larger than MAX_SIGNED_POWER_OF_TWO, this method returns Integer.MAX_VALUE
      See Also:
      • for a similar version, that is not yet implemented in the guava of Minecraft 1.8.