@VisibleForTesting
  static byte[] padBigEndianBytes(byte[] bigEndianBytes, int newLength) {
    if (bigEndianBytes.length == newLength) {
      return bigEndianBytes;
    } else if (bigEndianBytes.length < newLength) {
      byte[] result = new byte[newLength];
      if (bigEndianBytes.length == 0) {
        return result;
      }

      int start = newLength - bigEndianBytes.length;
      if (bigEndianBytes[0] < 0) {
        Arrays.fill(result, 0, start, (byte) 0xFF);
      }
      System.arraycopy(bigEndianBytes, 0, result, start, bigEndianBytes.length);

      return result;
    }
    throw new IllegalArgumentException(
        String.format(
            "Buffer size of %d is larger than requested size of %d",
            bigEndianBytes.length, newLength));
  }
@Test
  public void testPadBigEndianBytesNegative() {
    BigInteger bigInt = new BigInteger("-12345");
    byte[] bytes = bigInt.toByteArray();
    byte[] paddedBytes = DecimalVectorUtil.padBigEndianBytes(bytes, 16);

    assertThat(paddedBytes).hasSize(16);
    BigInteger result = new BigInteger(paddedBytes);
    assertThat(result).isEqualTo(bigInt);
  }