### Question:
ByteUtils { public static int compare(byte[] a, byte[] b) { int aLength = a.length; int bLength = b.length; for (int i = a.length - 1; i >= 0 && a[i] == 0; i--) { aLength--; } for (int i = b.length - 1; i >= 0 && b[i] == 0; i--) { bLength--; } if (aLength > bLength) { return 1; } else if (bLength > aLength) { return -1; } for (int k = 0; k < aLength; k++) { int A = a[k] & 0xff; int B = b[k] & 0xff; if (A > B) { return 1; } if (A < B) { return -1; } } return 0; }  static boolean equals(byte[] a, byte b[]); static byte[] toByteArray(BigInteger value); static byte[] toByteArray(double value); static byte[] toByteArray(long value); static byte[] toByteArray(byte[]... items); static BigInteger toBigInteger(byte[] input); static byte[] toByteArray(BigInteger input, int fixedSize); static int compare(byte[] a, byte[] b); static String toByteString(byte[] value); static String toByteString(byte[] value, boolean signed); static boolean isContainNullOrEmpty(byte[]... values);  }### Answer:
@Test public void compare() { byte[] left = new byte[]{1, 2, 4}; byte[] right = new byte[]{1, 2, 3}; assertEquals(ByteUtils.compare(left, right), 1); left = new byte[]{0, 1, 2, 3}; right = new byte[]{1, 2, 3}; assertEquals(ByteUtils.compare(left, right), 1); left = new byte[]{1, 2, 3}; right = new byte[]{1, 2, 4}; assertEquals(ByteUtils.compare(left, right), -1); left = new byte[]{1, 2, 3}; right = new byte[]{1, 2, 3}; assertEquals(ByteUtils.compare(left, right), 0); left = new byte[]{1, 2, 3, 0}; right = new byte[]{1, 2, 3, 0, 0}; assertEquals(ByteUtils.compare(left, right), 0); }