Class MathUtils

java.lang.Object
uk.ac.manchester.spinnaker.utils.MathUtils

public abstract class MathUtils
extends Object
Miscellaneous mathematical functions.
Author:
Donal Fellows
  • Method Details

    • ceildiv

      public static final int ceildiv​(int numerator, int denominator)
      Divide one integer by another with rounding up. For example, ceildiv(5,3) == 2
      Parameters:
      numerator - The value to be divided. Must be non-negative.
      denominator - The value to divide by. Must be positive.
      Returns:
      The value got by dividing the two, and rounding any floating remainder up.
    • hexbyte

      public static String hexbyte​(byte value)
      Converts a byte to its hexadecimal representation.
      Parameters:
      value - The byte to convert.
      Returns:
      The (unsigned) hexadecimal representation of the byte.