SortByOne { public static int[] sort(int[] array) { Integer[] integers = IntStream.of(array).mapToObj(Integer::valueOf).toArray(Integer[]::new); Arrays.sort(integers, Comparator.comparing(SortByOne::numberOfOne)); return Arrays.stream(integers).mapToInt(Integer::intValue).toArray(); }  static int[] sort(int[] array); static int numberOfOne(int intv);  }
@Test(dataProvider = "integersArray") public void test(int[] array, int[] afterSorted) { assertEquals(SortByOne.sort(array), afterSorted); }