Class Mathe

java.lang.Object
edu.rit.util.Mathe

public class Mathe extends Object
Class Mathe provides useful mathematical operations. The class is named "Mathe" so the compiler won't confuse it with class org.apache.commons.math3.util.FastMath.
Version:
11-Feb-2010
Author:
Alan Kaminsky
  • Method Details

    • sqrt

      public static int sqrt(int x)
      Compute the integer square root of the integer x. The value floor(x1/2) is returned. The answer is calculated using an exact integer algorithm taken from:
      Parameters:
      x - Input.
      Returns:
      Floor(x1/2).
      Throws:
      ArithmeticException - (unchecked exception) Thrown if x < 0.