package cs3250.sut;

public class someOps 
{
   /**
    * Computes the sum of elements from index i to index j (inclusive).
    *   
    * @param arr array of numbers,
    * @return average of numbers in arr 
    * @throws IllegalArgumentException if arr is null or empty or 
    *         if the range (i and/or j) to sum is improper
    */
   public static int computeRangeSum(int[] arr, int i, int j) 
   {
      if (arr == null || i < 0 || j >= arr.length || i > j) 
         throw new IllegalArgumentException("Invalid indices or null array.");
      
      int sum = 0;
      for (int k = i; k <= j; k++)     
         sum += arr[j];               
	        
      return sum;
   }
   
}
