List of utility methods to do Number Multiply
Object | multiply(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 { ... |
Long | multiplyForLong(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"); |
Long | multiplyLongs(Long a, Long b) multiply Longs return new Long(a.longValue() * b.longValue()); |
Number | multiplyNumbers(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()); ... |