public static Timestamp toTimestamp(BigDecimal bigDecimal) {
    final BigDecimal nanos = bigDecimal.remainder(BigDecimal.ONE.scaleByPowerOfTen(9));
    final BigDecimal seconds = bigDecimal.subtract(nanos).scaleByPowerOfTen(-9).add(MIN_SECONDS);

    return Timestamp.ofTimeSecondsAndNanos(seconds.longValue(), nanos.intValue());
  }
@Test(expected = IllegalArgumentException.class)
  public void testToTimestampThrowsExceptionWhenThereIsAnOverflow() {
    TimestampUtils.toTimestamp(new BigDecimal("315537897600000000000"));
  }