code: public static int indexOf(double[] array, double val) {
          for (int i=0; i<array.length; i++) {
              if (array[i] == val) {
                  return i;
              }
          }
          return -1;
      }
docs: Gets the first index of a given value in an array or -1 if not present.