jp2codec.util
Class MathUtil

java.lang.Object
  extended by jp2codec.util.MathUtil

public class MathUtil
extends java.lang.Object

This class contains a collection of utility methods fro mathematical operations. All methods are static.


Constructor Summary
MathUtil()
           
 
Method Summary
static int log2(int x)
          Method that calculates the floor of the log, base 2, of 'x'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtil

public MathUtil()
Method Detail

log2

public static int log2(int x)
Method that calculates the floor of the log, base 2, of 'x'. The calculation is performed in integer arithmetic, therefore, it is exact.

Parameters:
x - The value to calculate log2 on.
Returns:
floor(log(x)/log(2)), calculated in an exact way.