code: public static <A> int getIndexOfMaximum(A array, NumberArrayAdapter<?, A> adapter) throws IndexOutOfBoundsException {
      final int size = adapter.size(array);
      int index = 0;
      double max = adapter.getDouble(array, 0);
      for (int i = 1; i < size; i++) {
        double val = adapter.getDouble(array, i);
        if (val > max) {
          max = val;
          index = i;
        }
      }
      return index;
    }
docs: Returns the index of the maximum of the given values. If no value is bigger
  than the first, the index of the first entry is returned.
  
  @param <A> array type
  @param array Array to inspect
  @param adapter API adapter class
  @return the index of the maximum in the given values
  @throws IndexOutOfBoundsException if the length of the array is 0.