int scale = valNoTrailZeros.scale();
BigInteger unscaledVal = valNoTrailZeros.unscaledValue();
int sign = valNoTrailZeros.signum();
/* Then do the normalization. */
String unscaledValStr = unscaledVal.abs().toString();
int normalizedScale = unscaledValStr.length() - 1;
BigDecimal normalizedVal = new BigDecimal(unscaledVal,
normalizedScale);
int exponent = (normalizedScale - scale) * sign;