You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by _matthewHawthorne <mh...@alumni.pitt.edu> on 2003/06/21 20:41:08 UTC

[lang] NumberUtils minimum, maximum, and xor

I have 2 observations:

(1) Currently, the following methods are in o.a.c.l.NumberUtils

int maximum(int a, int b, int c)
long maximum(long a, long b, long c)
int minimum(int a, int b, int c)
long minimum(long a, long b, long c)

I think it be more flexible to replace them with the following:

int minimum(int[] intArr)
int maximum(int[] intArr)
long minimum(long[] longArr)
long maximum(long[] longArr)

It also may be a good time to add any missing methods such as:

short minimum(short[] shortArr)
short maximum(short[] shortArr)
float minimum(float[] floatArr)
float maximum(float[] floatArr)
double minimum(double[] doubleArr)
double maximum(double[] doubleArr)

Any thoughts?


(2) After searching for an easy way to xor booleans, and not finding
anything, I created a method:

boolean xor(boolean[] boolArr)

Would this be a good addition to NumberUtils?

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] NumberUtils minimum, maximum, and xor

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Just to note: we have moved somwhat along these lines in the the commons 
[math] sandbox component. Currently we have o.a.c.m.stat.StatUtils:

double min(double[] doubleArr)
double max(double[] doubleArr)

available there.

-Mark Diggory

_matthewHawthorne wrote:
> I have 2 observations:
> 
> (1) Currently, the following methods are in o.a.c.l.NumberUtils
> 
> int maximum(int a, int b, int c)
> long maximum(long a, long b, long c)
> int minimum(int a, int b, int c)
> long minimum(long a, long b, long c)
> 
> I think it be more flexible to replace them with the following:
> 
> int minimum(int[] intArr)
> int maximum(int[] intArr)
> long minimum(long[] longArr)
> long maximum(long[] longArr)
> 
> It also may be a good time to add any missing methods such as:
> 
> short minimum(short[] shortArr)
> short maximum(short[] shortArr)
> float minimum(float[] floatArr)
> float maximum(float[] floatArr)
> double minimum(double[] doubleArr)
> double maximum(double[] doubleArr)
> 
> Any thoughts?
> 
> 
> (2) After searching for an easy way to xor booleans, and not finding
> anything, I created a method:
> 
> boolean xor(boolean[] boolArr)
> 
> Would this be a good addition to NumberUtils?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org