cdm/src/main/java/ucar/ma2/Index.java
public void setDim(int dim, int value) {
    if (value < 0 || value >= shape[dim])  // check index here
      throw new ArrayIndexOutOfBoundsException();
    if (shape[dim] >= 0) //!vlen
      current[dim] = value;
  }
public void setDim(int dim, int value) {
    if (value < 0 || value >= shape[dim])  // check index here
      throw new ArrayIndexOutOfBoundsException();
    if (shape[dim] >= 0) //!vlen
      current[dim] = value;
  }
set current element at dimension dim to v

@param dim   set this dimension
@param value to this value