@Test
  public void testCalculateTenThirtySeven() {

    // find 10^37
    Decimal128 ten = new Decimal128(10, (short) 0);
    Decimal128 val = new Decimal128(1, (short) 0);
    for (int i = 0; i < 37; ++i) {
      val.multiplyDestructive(ten, (short) 0);
    }

    // verify it
    String s = val.toFormalString();
    assertEquals("10000000000000000000000000000000000000", s);
    boolean overflow = false;
  }
This code was based on code from Microsoft's PolyBase.
common/src/test/org/apache/hadoop/hive/common/type/TestDecimal128.java