public static Number transformNumber( Number input ) {
      if( input instanceof Float ){
         return new Double( input.toString() );
      }else if( input instanceof Short ){
         return new Integer( input.intValue() );
      }else if( input instanceof Byte ){
         return new Integer( input.intValue() );
      }else if( input instanceof Long ){
         Long max = new Long( Integer.MAX_VALUE );
         if( input.longValue() <= max.longValue() && input.longValue() >= Integer.MIN_VALUE ){
            return new Integer( input.intValue() );
         }
      }

      return input;
   }
public static Number transformNumber ( Number input ) { if ( input instanceof Float ) { return new Double ( input . toString ( ) ) ; } else if ( input instanceof Short ) { return new Integer ( input . intValue ( ) ) ; } else if ( input instanceof Byte ) { return new Integer ( input . intValue ( ) ) ; } else if ( input instanceof Long ) { Long max = new Long ( Integer . MAX_VALUE ) ; if ( input . longValue ( ) <= max . longValue ( ) && input . longValue ( ) >= Integer . MIN_VALUE ) { return new Integer ( input . intValue ( ) ) ; } } return input ; }
Transforms a Number into a valid javascript number.<br>
Float gets promoted to Double.<br>
Byte and Short get promoted to Integer.<br>
Long gets downgraded to Integer if possible.<br>