Java Utililty Methods Number Sum

List of utility methods to do Number Sum

Description

The list of methods to do Number Sum are organized into topic(s).

Method

longsum(long space1, String space2)
sum
if (space1 == 0) {
    return Long.parseLong(space2);
long total2 = Long.parseLong(space2);
return space1 + total2;
doublesum(long x, int c)
sum
return (double) x + c;
Numbersum(Number n1, Number n2)
Sum two numbers
Class<?> type = getComputationType(n1, n2);
Number val1 = convertTo(n1, type);
Number val2 = convertTo(n2, type);
if (type == Long.class)
    return Long.valueOf(val1.longValue() + val2.longValue());
return new Double(val1.doubleValue() + val2.doubleValue());
intSum(Object in, int min, int max)
Sum
if (in instanceof boolean[]) {
    boolean[] inn = (boolean[]) in;
    if (max >= inn.length)
        max = inn.length - 1;
    int out = 0;
    for (int i = min; i <= max; i++)
        out += inn[i] ? 1 : 0;
    return out;
...
Stringsum(String fieldName)
wrap the given field name with SQL function "sum"
return "sum(" + fieldName + ")";
Stringsum(String str11, String str22)
sum
int index1 = str11.indexOf(".");
int len1 = str11.length() - 1 - index1;
int index2 = str22.indexOf(".");
int len2 = str22.length() - 1 - index2;
if (str11.contains(".") && str22.contains(".")) {
    if (len1 > len2) {
        str22 = compare2(str11, str22, len1, len2);
    } else if (len1 < len2) {
...
intsum0ToN(int n)
Returns the sum of integers from 0 up to n.
if (n < 0) {
    throw new IllegalArgumentException("Argument must be >= 0: " + n);
return n * (n + 1) / 2;
longsum_quad(long max)
Summe der Quadrate
long result = 0;
for (int i = 1; i <= max; ++i)
    result += i * i;
return result;
longsum_quad_endrec(long max)
Summe der Quadrate endrekursiv
return quad_endrec(0, max);
StringsumaMesFull(String sF, int n)
suma Mes Full
int n0 = Math.abs(n);
String sF0 = sF;
for (int i = 0; i < n0; i++) {
    sF0 = incMesFull(sF0);
return sF0;