|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quadrique.jbuildingblocks.core.math.JbbMath
public class JbbMath
A Utility class that provides some simple mathematical functions.
| Method Summary | |
|---|---|
double |
convertFloatToDouble(float in)
This method performs a slower but more acurate conversion than the default (implicit or explicit) float to double conversion. |
boolean |
equalsDouble(double a,
double b)
uses Dr. |
boolean |
equalsDouble(double a,
double b,
double precision)
|
int |
getModulo(double value,
double bucket)
|
int |
getRandomInteger(int max)
|
String |
getRandomString(int len)
returns String containing 0-128 characters for the given length. |
static JbbMath |
newInstance()
|
double |
round(double in,
int nbOfFractionalDigits)
|
double |
round(double in,
int nbOfFractionalDigits,
RoundingMode roundingMode)
|
float |
round(float in,
int nbOfFractionalDigits)
|
float |
round(float in,
int nbOfFractionalDigits,
RoundingMode roundingMode)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static JbbMath newInstance()
public int getRandomInteger(int max)
throws Exception
max - an integer value superior or equal to 1 (if 1, the result will always be 0)
Exception
public int getModulo(double value,
double bucket)
throws Exception
value - bucket -
Exception
public float round(float in,
int nbOfFractionalDigits,
RoundingMode roundingMode)
in - nbOfFractionalDigits - roundingMode -
public float round(float in,
int nbOfFractionalDigits)
in - nbOfFractionalDigits -
public double round(double in,
int nbOfFractionalDigits)
in - nbOfFractionalDigits -
public double round(double in,
int nbOfFractionalDigits,
RoundingMode roundingMode)
in - nbOfFractionalDigits - roundingMode -
public double convertFloatToDouble(float in)
throws Exception
float in = 280085.12f;
System.out.println("INPUT FLOAT VALUE:" + in);
double out = (double)in;
System.out.println("default explicit conversion:" + out);
out = in;
System.out.println("default implicit conversion:" + out);
out=JbbMathHandler.convertFloatToDouble(in);
System.out.println("DOUBLE VALUE:" + out);
in -
Exception
public boolean equalsDouble(double a,
double b)
public boolean equalsDouble(double a,
double b,
double precision)
public String getRandomString(int len)
throws Exception
len -
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||