code: public static int calculateEncodedLength(BigDecimal value) {
          if (value == null || value.signum() == 0) {
              return 1;
          }
  
          return encode(value).mLength;
      }
docs: Returns the amount of bytes required to encode a BigDecimal.
  
  <p><i>Note:</i> It is recommended that value be normalized by stripping
  trailing zeros. This makes searching by value much simpler.
  
  @param value BigDecimal value to encode, may be null
  @return amount of bytes needed to encode
  @since 1.2