forked from plusone/plusone-commons
修复错误。
parent
eae16c395f
commit
8000ca18a5
|
@ -36,7 +36,7 @@ public class NumberUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long sum(final int... numbers) {
|
public static long sum(final int... numbers) {
|
||||||
int result = 0;
|
long result = 0L;
|
||||||
for (int number : numbers) {
|
for (int number : numbers) {
|
||||||
result += number;
|
result += number;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class NumberUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long sum(final long... numbers) {
|
public static long sum(final long... numbers) {
|
||||||
long result = 0;
|
long result = 0L;
|
||||||
for (long number : numbers) {
|
for (long number : numbers) {
|
||||||
result += number;
|
result += number;
|
||||||
}
|
}
|
||||||
|
@ -52,15 +52,15 @@ public class NumberUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double sum(final float... numbers) {
|
public static double sum(final float... numbers) {
|
||||||
double result = 0;
|
double result = 0.00;
|
||||||
for (double number : numbers) {
|
for (float number : numbers) {
|
||||||
result += number;
|
result += number;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double sum(final double... numbers) {
|
public static double sum(final double... numbers) {
|
||||||
double result = 0;
|
double result = 0.00;
|
||||||
for (double number : numbers) {
|
for (double number : numbers) {
|
||||||
result += number;
|
result += number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue