public static BigDecimal toNanos(Timestamp timestamp) {
    final BigDecimal secondsAsNanos =
        BigDecimal.valueOf(timestamp.getSeconds()).subtract(MIN_SECONDS).scaleByPowerOfTen(9);
    final BigDecimal nanos = BigDecimal.valueOf(timestamp.getNanos());

    return secondsAsNanos.add(nanos);
  }
@Test
  public void testToNanosConvertTimestampMin() {
    assertEquals(BigDecimal.valueOf(0L), TimestampUtils.toNanos(Timestamp.MIN_VALUE));
  }