public static BigDecimal toBigDecimal ( Number self ) { // Quick method for scalars. if ( ( self instanceof Long ) || ( self instanceof Integer ) || ( self instanceof Short ) || ( self instanceof Byte ) ) { return BigDecimal . valueOf ( self . longValue ( ) ) ; } return new BigDecimal ( self . toString ( ) ) ; }
Transform a Number into a BigDecimal