/**
 * A collection of methods related to integer arrays.
 */
public class ArrayStuff {

  /**
   * Print the contents of list on one line, separated by commas and spaces
   * and surrounded by [ and ].
   * @param list the sorted array.
   */
  public static void print(int[] list) {
  }

  /**
   * Print the contents of list[0..i-1] on one line, separated by commas
   * and spaces and surrounded by [ and ].
   * @param list the sorted array.
   * @param i the number of items in list to print.
   */
  public static void print(int[] list, int i) {
  }

  /**
   * Return whether k is anywhere in list.
   * @param list the sorted array.
   * @param k the number to search for.
   */
  public static boolean hasElement(int[] list, int k) {
    return false;
  }

  /**
   * Return whether k is anywhere in list[i..j].
   * @param list the sorted array.
   * @param i the index of the start of the range to be searched.
   * @param j the index of the end of the range to be searched.
   * @param k the number to search for.
   */
  public static boolean hasElement(int[] list, int i, int j, int k) {
    return false;
  }

  /**
   * Return whether k is an element in list.
   * @param list the array to be searched.
   * @param k the number to search for.
   */
  public static boolean hasElement(int[][] list, int k) {
    return false;
  }

  /**
   * Return whether k is in list[rowI..rowJ][colI..colJ].
   * (That describes a rectangular portion of a two-dimensional array.)
   * @param list the array to be searched.
   * @param rowI the index of the start of the horizontal range to be searched.
   * @param rowJ the index of the end of the horizontal range to be searched.
   * @param colI the index of the start of the vertical range to be searched.
   * @param colJ the index of the end of the vertical range to be searched.
   * @param k the number to search for.
   */
  public static boolean hasElement(
    int[][] list, int rowI, int rowJ, int colI, int colJ, int k) {
    return false;
  }

  /**
   * Test the various methods in this class.
   */
  public static void main(String[] args) {

    /*
     * The following line creates an int[] object of length 2 with 11 and
     * 13 in it. It's called an "array initializer".
     */
    int[] a = new int[]{11, 13};

    print(a);    // Result: [11, 13]
    print(a, 0); // Result: []
    print(a, 1); // Result: [11]
    print(a, 2); // Result: [11, 13]

    System.out.println(hasElement(a, 13)); // Result: true
    System.out.println(hasElement(a, 14)); // Result: false

    System.out.println(hasElement(a, 0, 1, 11)); // Result: true
    System.out.println(hasElement(a, 1, 1, 11)); // Result: false
    System.out.println(hasElement(a, 2, 1, 11)); // Result: false

    a = new int[]{};
    System.out.println(hasElement(a, 13)); // Result: false
    System.out.println(hasElement(a, 0, -1, 11)); // Result: false

    /*
     * The following line creates an int[][] that looks like this:
     *    8 11 13
     *    1  2  3
     */
    int[][] b = new int[][]{ {8, 11, 13}, {1, 2, 3} };
    System.out.println(hasElement(b, 0, 1, 1, 2, 3)); // Should be true.
    System.out.println(hasElement(b, 0, 1, 0, 1, 3)); // Should be false.
  }

}
