public static int compare(byte[] left, byte[] right) {
    return compare(left, 0, left.length, right, 0, right.length);
  }
@Test
  public void testCompare() {
    byte[] foo = "foo".getBytes(StandardCharsets.UTF_8);
    assertEquals(ByteArray.compare(foo, foo), 0);
    assertEquals(ByteArray.compare(foo, Arrays.copyOf(foo, foo.length)), 0);
    assertTrue(ByteArray.compare(foo, Arrays.copyOf(foo, foo.length - 1)) > 0);
    assertTrue(ByteArray.compare(foo, Arrays.copyOf(foo, foo.length + 1)) < 0);
    byte[] bar = "bar".getBytes(StandardCharsets.UTF_8);
    assertTrue(ByteArray.compare(foo, bar) > 0);
    assertTrue(ByteArray.compare(bar, foo) < 0);
    assertTrue(ByteArray.compare(Arrays.copyOf(bar, bar.length - 1), foo) < 0);
    assertTrue(ByteArray.compare(Arrays.copyOf(bar, bar.length + 1), foo) < 0);
  }