ArrayUtil { public static final void reverse(byte[] a) { byte tmp; for (int i = 0, mid = a.length >> 1; i < mid; i++) { tmp = a[i]; a[i] = a[a.length - 1 - i]; a[a.length - 1 - i] = tmp; } } private  ArrayUtil(); static final void reverse(byte[] a);  }
@Test public final void noElements() { byte[] expecteds = new byte[] {}; byte[] actuals = new byte[] {}; ArrayUtil.reverse(actuals); Assert.assertArrayEquals(expecteds, actuals); }
@Test public final void evenNumberOfElements() { byte[] expecteds = new byte[] { 4, 3, 2, 1 }; byte[] actuals = new byte[] { 1, 2, 3, 4 }; ArrayUtil.reverse(actuals); Assert.assertArrayEquals(expecteds, actuals); }
@Test public final void oddNumberOfElements() { byte[] expecteds = new byte[] { 3, 2, 1 }; byte[] actuals = new byte[] { 1, 2, 3 }; ArrayUtil.reverse(actuals); Assert.assertArrayEquals(expecteds, actuals); }