cdm/src/main/java/ucar/ma2/Index.java
public void setCurrentCounter(int currElement) {
    currElement -= offset;
    for (int ii = 0; ii < rank; ii++) { // general rank
      if (shape[ii] < 0) {
        current[ii] = -1;
        break;
      }
      current[ii] = currElement / stride[ii];
      currElement -= current[ii] * stride[ii];
    }
    set(current); // transfer to subclass fields
  }
public void setCurrentCounter(int currElement) {
    currElement -= offset;
    for (int ii = 0; ii < rank; ii++) { // general rank
      if (shape[ii] < 0) {
        current[ii] = -1;
        break;
      }
      current[ii] = currElement / stride[ii];
      currElement -= current[ii] * stride[ii];
    }
    set(current); // transfer to subclass fields
  }
public void setCurrentCounter ( int currElement ) { currElement -= offset ; for ( int ii = 0 ; ii < rank ; ii ++ ) { // general rank
 if ( shape [ ii ] < 0 ) { current [ ii ] = - 1 ; break ; } current [ ii ] = currElement / stride [ ii ] ; currElement -= current [ ii ] * stride [ ii ] ; } set ( current ) ; // transfer to subclass fields
 }
Set the current counter from the 1D "current element"
currElement = offset + stride[0]*current[0] + ...

@param currElement set to this value
Set the current counter from the 1D current element currElement = offset + stride [ 0 ] * current [ 0 ] + ...