Problem4_2 { public static IntPair minimize_unsorted(int[] numbers) { int[] sorted = IntStream.of(numbers).sorted().toArray(); return minimize_sorted(sorted); }  static IntPair maximize_unsorted(int[] numbers); static IntPair maximize_sorted(int[] numbers); static IntPair minimize_unsorted(int[] numbers); static IntPair minimize_sorted(int[] sorted);  }
@Test public void shouldFindPairThatMinimizeWithinUnsortedArray() throws Exception { int[] numbers = {6, 13, 19, 3, 8, 14}; IntPair p = Problem4_2.minimize_unsorted(numbers); assertThat(p, equalTo(new IntPair(13, 14))); }