@Test
public void testReverse() {

    int[] x = new int[0];
    // don't crash with no input
    Sort.reverse(x);
    // reverse stuff!
    x = new int[]{1, 2, 3, 4, 5};
    Sort.reverse(x);
    for (int i = 0; i < 5; i++) {
        assertEquals(5 - i, x[i]);
    }
    // reverse some stuff back
    Sort.reverse(x, 1, 3);
    assertEquals(5, x[0]);
    assertEquals(2, x[1]);
    assertEquals(3, x[2]);
    assertEquals(4, x[3]);
    assertEquals(1, x[4]);
    // another no-op
    Sort.reverse(x, 3, 0);
    assertEquals(5, x[0]);
    assertEquals(2, x[1]);
    assertEquals(3, x[2]);
    assertEquals(4, x[3]);
    assertEquals(1, x[4]);
    x = new int[]{1, 2, 3, 4, 5, 6};
    Sort.reverse(x);
    for (int i = 0; i < 6; i++) {
        assertEquals(6 - i, x[i]);
    }
}