code: static int max(int[] input, int start, int length) {
          assert length >= 1;
  
          int max = input[start];
          for (int i = length - 2, index = start + 1; i >= 0; i--, index++) {
              final int v = input[index];
              if (v > max) {
                  max = v;
              }
          }
  
          return max;
      }
docs: Determine the maximum value in a slice of an array.