cdm/src/main/java/ucar/nc2/util/cache/SmartArrayInt.java
public int findIdx(int want) {
    if (isConstant) return (want == start)  ? 0 : -1;
    if (isSequential) return want - start;
    if (isSorted) {
      return Arrays.binarySearch(raw, want);
    }
    // linear search
    for (int i=0; i<raw.length; i++)
      if (raw[i] == want) return i;
    return -1;
  }
public int findIdx(int want) {
    if (isConstant) return (want == start)  ? 0 : -1;
    if (isSequential) return want - start;
    if (isSorted) {
      return Arrays.binarySearch(raw, want);
    }
    // linear search
    for (int i=0; i<raw.length; i++)
      if (raw[i] == want) return i;
    return -1;
  }
public int findIdx ( int want ) { if ( isConstant ) return ( want == start ) ? 0 : - 1 ; if ( isSequential ) return want - start ; if ( isSorted ) { return Arrays . binarySearch ( raw , want ) ; } // linear search for ( int i = 0 ; i < raw . length ; i ++ ) if ( raw [ i ] == want ) return i ; return - 1 ; }
Find which index holds the value want
@param want  value wanted
@return < 0 if not found, else the index. If duplicates, then return any match
Find which index holds the value want