diff --git a/src/java/org/apache/commons/lang/NumberRange.java b/src/java/org/apache/commons/lang/NumberRange.java
index 8804af847..3d42924d1 100644
--- a/src/java/org/apache/commons/lang/NumberRange.java
+++ b/src/java/org/apache/commons/lang/NumberRange.java
@@ -1,5 +1,3 @@
-package org.apache.commons.lang;
-
/* ====================================================================
* The Apache Software License, Version 1.1
*
@@ -53,17 +51,21 @@ package org.apache.commons.lang;
* information on the Apache Software Foundation, please see
*
Represents a range of {@link Number} objects.
+ * + *This class uses double
comparisons. This means that it
+ * is unsuitable for dealing with large Long
, BigDecimal
+ * or BigInteger
numbers.
Constructs a new NumberRange
with the specified
* minimum and maximum numbers.
If the maximum is less than the minimum, the range will be constructed + * from the minimum value to the minimum value, not what you would expect!.
* * @param min the minimum number in this range * @param max the maximum number in this range @@ -98,9 +103,9 @@ public final class NumberRange { */ public NumberRange(Number min, Number max) { if (min == null) { - throw new NullPointerException("min cannot be null"); + throw new NullPointerException("The minimum value must not be null"); } else if (max == null) { - throw new NullPointerException("max cannot be null"); + throw new NullPointerException("The maximum value must not be null"); } if (max.doubleValue() < min.doubleValue()) { @@ -131,7 +136,7 @@ public final class NumberRange { /** *Tests whether the specified number
occurs within
- * this range.
double
comparison.
*
* @param number the number to test
* @return true
if the specified number occurs within this
@@ -148,7 +153,7 @@ public final class NumberRange {
/**
* Tests whether the specified range occurs entirely within this - * range.
+ * range usingdouble
comparison.
*
* @param range the range to test
* @return true
if the specified range occurs entirely within
@@ -163,7 +168,8 @@ public final class NumberRange {
}
/**
- * Tests whether the specified range overlaps with this range.
+ *Tests whether the specified range overlaps with this range
+ * using double
comparison.
true
if the specified range overlaps with this
@@ -221,7 +227,7 @@ public final class NumberRange {
public String toString() {
StringBuffer sb = new StringBuffer();
- if (min.intValue() < 0) {
+ if (min.doubleValue() < 0) {
sb.append('(')
.append(min)
.append(')');
@@ -231,7 +237,7 @@ public final class NumberRange {
sb.append('-');
- if (max.intValue() < 0) {
+ if (max.doubleValue() < 0) {
sb.append('(')
.append(max)
.append(')');