/** Counts the number of times an integer appears in an array. */
  public static int findCount(int[] a, int k) {
    int count = 0;
    for (int e: a) {	// note the use of the "foreach" loop
      if (e == k)	// check if the current element equals k
	count++;
    }
    return count;
  }