|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.charlesames.utility.math.MathMethods
public abstract class MathMethods
Miscellaneous Math methods.
The author of the permutations and combinations methods is unknown.
The code source for these two methods is http://www.koders.com/java/fidB0DF1A89F0472F6F4039AF61944BA2D072AF6032.aspx
| Field Summary | |
|---|---|
static double |
LOG2
|
static double |
ONE_PLUS
|
static double |
TINY
|
static double |
TWO_PI
|
| Constructor Summary | |
|---|---|
MathMethods()
|
|
| Method Summary | |
|---|---|
static int |
abs(int i)
|
static long |
combinations(long n,
long r)
code source: http://www.koders.com/java/fidB0DF1A89F0472F6F4039AF61944BA2D072AF6032.aspx |
static int |
compareDouble(double value1,
double value2)
|
static double |
doubleFromText(java.lang.String valueText)
Converts text to double-precision numbers, using option-5 to represent infinity. |
static boolean |
even(int a)
|
static long |
factorial(int i)
|
static long |
factorial(long n)
|
static java.lang.String |
formatDouble(java.lang.Double value,
int maxDecimalPoints)
Converts double-precision numbers into text with a limited number of decimal places. |
static long |
gcd(long a,
long b)
|
static boolean |
haveSmallDifference(double a,
double b)
Tests if the difference between to double-precision numbers is very small. |
static java.lang.String |
htmlFromDouble(double value)
Converts double-precision numbers to HTML text, using option-5 to represent infinity. |
static int |
intFromText(java.lang.String valueText)
Converts text to integers, using option-5 to represent infinity. |
static boolean |
isLarge(double a)
Tests if a double precision number is very large. |
static boolean |
isSmall(double a)
Tests if a double precision number is very small. |
static long |
lcm(long a,
long b)
|
static double |
modulo(double a,
double b)
Calculates a modulo b using the actual rules of modular arithmetic. |
static int |
modulo(int a,
int b)
Calculates a modulo b using the actual rules of modular arithmetic. |
static long |
permutations(long n,
long r)
code source: http://www.koders.com/java/fidB0DF1A89F0472F6F4039AF61944BA2D072AF6032.aspx |
static double |
reflect(double a,
double b)
Reflects a into the range from 0 to b. |
static int |
reflect(int a,
int b)
Reflects a into the range from 0 to b. |
static void |
sortDescending(double[] array)
|
static java.lang.String |
textFromDouble(double value)
Converts double-precision numbers to text, using option-5 to represent infinity. |
static java.lang.String |
textFromInt(int value)
Converts integers to text, using option-5 to represent infinity. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double TINY
public static final double ONE_PLUS
public static final double LOG2
public static final double TWO_PI
| Constructor Detail |
|---|
public MathMethods()
| Method Detail |
|---|
public static int modulo(int a,
int b)
a - The argumentb - The modulus
public static int reflect(int a,
int b)
a - The argumentb - The modulus
public static boolean even(int a)
a -
public static double modulo(double a,
double b)
a - The argumentb - The modulus
public static double reflect(double a,
double b)
a - The argumentb - The modulus
public static int intFromText(java.lang.String valueText)
throws java.lang.NumberFormatException
valueText -
java.lang.NumberFormatExceptionpublic static java.lang.String textFromInt(int value)
value -
public static boolean isLarge(double a)
a - A double-precision number.
public static boolean isSmall(double a)
a - A double-precision number.
public static boolean haveSmallDifference(double a,
double b)
a - A double-precision number.b - A double-precision number.
public static double doubleFromText(java.lang.String valueText)
valueText -
public static java.lang.String formatDouble(java.lang.Double value,
int maxDecimalPoints)
value - The input number.maxDecimalPoints - The maximum number of decimal places.
public static java.lang.String textFromDouble(double value)
value -
public static java.lang.String htmlFromDouble(double value)
value -
public static long gcd(long a,
long b)
a - b -
public static long lcm(long a,
long b)
a - b -
public static int compareDouble(double value1,
double value2)
value1 - value2 -
public static long factorial(int i)
i -
public static long factorial(long n)
n -
public static long combinations(long n,
long r)
n - r -
public static long permutations(long n,
long r)
n - r -
public static void sortDescending(double[] array)
array - public static int abs(int i)
i -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||