static int @NotNull [] calcMinMax(int[] array, int length) {
    int max = Integer.MIN_VALUE;
    int min = Integer.MAX_VALUE;
    for (int i = 0; i < length; ++i) {
      max = Math.max(max, array[i]);
      min = Math.min(min, array[i]);
    }
    return new int[]{min, max};
  }
static int @NotNull [] calcMinMax(int[] array, int length)