ch.ethz.iks.util
Class MathUtils

java.lang.Object
  extended by ch.ethz.iks.util.MathUtils

public final class MathUtils
extends java.lang.Object

Math utilities.

Since:
0.2
Author:
Jan S. Rellermeyer, ETH Zürich

Method Summary
static long abs(long val)
          get the absolute value of a long.
static long higher32(long val)
          get the higher 32 bits of a long value.
static int log2(int num)
          get the logarithm with base 2.
static long lower32(long val)
          get the lower 32 bits of a long value.
static long max(long[] values)
          get the maximum within an array of long values.
static long min(long[] values)
          get the minimum within an array of long values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

log2

public static int log2(int num)
get the logarithm with base 2.

Parameters:
num - the value.
Returns:
the logarithm.
Since:
0.2

lower32

public static long lower32(long val)
get the lower 32 bits of a long value.

Parameters:
val - the long value.
Returns:
the lower 32 bits.
Since:
0.2

higher32

public static long higher32(long val)
get the higher 32 bits of a long value.

Parameters:
val - the long value.
Returns:
the higher 32 bits.
Since:
0.2

abs

public static long abs(long val)
get the absolute value of a long.

Parameters:
val - the (signed) long value.
Returns:
the absolute value.
Since:
0.2

max

public static long max(long[] values)
get the maximum within an array of long values.

Parameters:
values - the array of long values.
Returns:
the maximum.
Since:
0.2

min

public static long min(long[] values)
get the minimum within an array of long values.

Parameters:
values - the array of long values.
Returns:
the minimum.
Since:
0.2


Copyright © 2009 IKS, ETH Zurich. All Rights Reserved.