org.objectweb.petals.tools.webadmin.util
Class MathTools

java.lang.Object
  extended by org.objectweb.petals.tools.webadmin.util.MathTools

public final class MathTools
extends java.lang.Object

some mathematics usefull methods...


Field Summary
static int HUNDRED
           
static int TEN
           
static int THOUSAND
           
 
Method Summary
static long elementMax(java.lang.Long[] numbers)
          Returns the maximum element of an array of long numbers
static long elementMin(java.lang.Long[] numbers)
          Returns the minimum element of an array of long numbers
static double nbPerSec(long time, int nbElem)
          Returns a number of elements per second
static double percent(int value, int total)
          Returns the value as a percentage of the total
static double round(double number, int precision)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HUNDRED

public static final int HUNDRED
See Also:
Constant Field Values

TEN

public static final int TEN
See Also:
Constant Field Values

THOUSAND

public static final int THOUSAND
See Also:
Constant Field Values
Method Detail

elementMax

public static long elementMax(java.lang.Long[] numbers)
Returns the maximum element of an array of long numbers

Parameters:
numbers - array of long numbers
Returns:
the biger number

elementMin

public static long elementMin(java.lang.Long[] numbers)
Returns the minimum element of an array of long numbers

Parameters:
numbers - array of long numbers
Returns:
the smaller number

nbPerSec

public static double nbPerSec(long time,
                              int nbElem)
Returns a number of elements per second

Parameters:
time - time elapsed
nbElem - total number of elements
Returns:
the average as a double

percent

public static double percent(int value,
                             int total)
Returns the value as a percentage of the total

Parameters:
value - number to transform
total - reference number
Returns:
the percentage as a double

round

public static double round(double number,
                           int precision)


Copyright © 2005-2007 ObjectWeb Consortium. All Rights Reserved.