code: public static int ravelIndex(int[] indices, int[] dims) {
          int c = 0;
          int[] strides = getStrides(dims);
          for (int i=0; i<indices.length; i++) {
              c += strides[i] * indices[i];
          }
          return c;
      }
docs: Gets the index into the values array that corresponds to the indices.