code: public static BigDecimal bigDecimalValue(BigDecimal val)
      {
          if (val == null
              || val.getClass() == BigDecimal.class)
          {
              return val;
          }
          return new BigDecimal(val.unscaledValue(), val.scale());
      }
docs: Returns a "plain" {@link BigDecimal} instance, never a {@link Decimal}
  subclass.  As a side effect, this strips any negative-zero information.
  
  @param val may be null.
  @return {@code null} if the given value is {@code null}.