code: private static  Number times(Number a, Number b) 
    {
      int aType = getType(a);
      int bType = getType(b);
      
      int compType = (aType >= bType) ? aType : bType;
      switch (compType)  
      {
        case INT :
          return new Integer(a.intValue() * b.intValue());
        case LONG :
          return new Long(a.longValue() * b.longValue());
        case FLOAT :
          return new Float(a.floatValue() * b.floatValue());
        case DOUBLE :
          return new Double(a.doubleValue() * b.doubleValue());
        default :
          throw new IllegalStateException();
      }
    }
docs: Multiply two values