org.databene.commons
Class MathUtil

java.lang.Object
  extended by org.databene.commons.MathUtil

public class MathUtil
extends java.lang.Object

Provides mathematical utility methods.

Since:
0.4.0
Author:
Volker Bergmann

Constructor Summary
MathUtil()
           
 
Method Summary
static boolean between(double x, double min, double max)
           
static boolean between(long x, long min, long max)
           
static int fractionDigits(double number)
          Returns the number of digits needed for displaying the postfix values of a number, but at most 7.
static int prefixDigits(double number)
           
static boolean rangeIncludes(double x, double min, double max)
           
static boolean rangeIncludes(long x, long min, long max)
           
static int sumOfDigits(int i)
           
static int weightedSumOfDigits(java.lang.CharSequence number, int startIndex, int... weights)
           
static int weightedSumOfSumOfDigits(java.lang.String number, int startIndex, int... weights)
           
 
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

fractionDigits

public static int fractionDigits(double number)
Returns the number of digits needed for displaying the postfix values of a number, but at most 7.

Parameters:
number -
Returns:
the number of digits needed for displaying the postfix values of a number, but at most 7

prefixDigits

public static int prefixDigits(double number)

sumOfDigits

public static int sumOfDigits(int i)

weightedSumOfSumOfDigits

public static int weightedSumOfSumOfDigits(java.lang.String number,
                                           int startIndex,
                                           int... weights)

weightedSumOfDigits

public static int weightedSumOfDigits(java.lang.CharSequence number,
                                      int startIndex,
                                      int... weights)

rangeIncludes

public static boolean rangeIncludes(long x,
                                    long min,
                                    long max)

rangeIncludes

public static boolean rangeIncludes(double x,
                                    double min,
                                    double max)

between

public static boolean between(long x,
                              long min,
                              long max)

between

public static boolean between(double x,
                              double min,
                              double max)


Copyright © 2010. All Rights Reserved.