public static long encodeShortScaledValue(BigDecimal value, int scale)
    {
        checkArgument(scale >= 0);
        return value.setScale(scale, UNNECESSARY).unscaledValue().longValueExact();
    }
@Test
    public void testEncodeShortScaledValue()
    {
        assertEquals(encodeShortScaledValue(new BigDecimal("2.00"), 2), 200L);
        assertEquals(encodeShortScaledValue(new BigDecimal("2.13"), 2), 213L);
        assertEquals(encodeShortScaledValue(new BigDecimal("172.60"), 2), 17260L);
        assertEquals(encodeShortScaledValue(new BigDecimal("2"), 2), 200L);
        assertEquals(encodeShortScaledValue(new BigDecimal("172.6"), 2), 17260L);

        assertEquals(encodeShortScaledValue(new BigDecimal("-2.00"), 2), -200L);
        assertEquals(encodeShortScaledValue(new BigDecimal("-2.13"), 2), -213L);
        assertEquals(encodeShortScaledValue(new BigDecimal("-2"), 2), -200L);
    }