private static int randomNanos(Random rand, int decimalDigits) {
    // Only keep the most significant decimalDigits digits.
    int nanos = rand.nextInt(BILLION);
    return nanos - nanos % (int) Math.pow(10, 9 - decimalDigits);
  }
Pad the given byte array with the given number of bytes in the beginning. The padding bytes
deterministically depend on the passed data.
serde/src/test/org/apache/hadoop/hive/serde2/io/TestTimestampWritableV2.java