Java Utililty Methods Number Multiply

List of utility methods to do Number Multiply

Description

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

Method

Objectmultiply(V1 value1, V2 value2)
multiply
Object ret = null;
if (null == value1 && null == value2) {
    ret = 0;
} else if (null == value1) {
    ret = value2;
} else if (null == value2) {
    ret = value1;
} else {
...
LongmultiplyForLong(final Number operand1, final int operand2)
Multiplies an object number by a primitive int and returns a Long.
if (operand1 instanceof Double) {
    return Long.valueOf(Math.round(operand1.doubleValue() * operand2));
throw new IllegalArgumentException(operand1.getClass() + " not supported");
LongmultiplyLongs(Long a, Long b)
multiply Longs
return new Long(a.longValue() * b.longValue());
NumbermultiplyNumbers(Number a, Number b)
multiply Numbers
if (a instanceof Double || b instanceof Double) {
    return Double.valueOf(a.doubleValue() * b.doubleValue());
} else if (a instanceof Float || b instanceof Float) {
    return Float.valueOf(a.floatValue() * b.floatValue());
} else if (a instanceof Long || b instanceof Long) {
    return Long.valueOf(a.longValue() * b.longValue());
} else if (a instanceof Integer || b instanceof Integer) {
    return Integer.valueOf(a.intValue() * b.intValue());
...