### Question:
WALKey { public static byte[] prefixUpperExclusive(byte[] keyFragment) { byte[] upper = new byte[keyFragment.length]; System.arraycopy(keyFragment, 0, upper, 0, keyFragment.length); for (int i = upper.length - 1; i >= 0; i--) { if (upper[i] == -1) { upper[i] = 0; } else if (upper[i] == Byte.MAX_VALUE) { upper[i] = Byte.MIN_VALUE; break; } else { upper[i]++; break; } } return upper; } WALKey(byte[] prefix, byte[] key); byte[] compose(); int sizeOfComposed(); static byte[] compose(byte[] prefix, byte[] key); static int sizeOfComposed(int sizeOfPrefix, int sizeOfKey); static boolean decompose(TxFpRawKeyValueEntries<E> keyEntries, TxFpKeyValueEntryStream<E> stream); static byte[] rawKeyPrefix(byte[] rawKey); static byte[] rawKeyKey(byte[] rawKey); static ByteBuffer rawKeyKey(ByteBuffer rawKey); static byte[] prefixUpperExclusive(byte[] keyFragment); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object o); final byte[] prefix; final byte[] key; }### Answer:
@Test public void testPrefixUpperExclusive() throws Exception { for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) { byte[] lower = new byte[] { 0, 0, 0, (byte) i }; byte[] upper = WALKey.prefixUpperExclusive(lower); int c = KeyUtil.compare(lower, upper); Assert.assertTrue(c < 0, Arrays.toString(lower) + " vs " + Arrays.toString(upper) + " = " + c); } }