code: public static long getOffset(long baseOffset, int[] shape, int[] stride, int... indices) {
          //int ret =  mappers[shape.length].getOffset(baseOffset, shape, stride, indices);
          if (shape.length != stride.length || indices.length != shape.length)
              throw new IllegalArgumentException("Indexes, shape, and stride must be the same length");
          long offset = baseOffset;
          for (int i = 0; i < shape.length; i++) {
              if (indices[i] >= shape[i])
                  throw new IllegalArgumentException(
                          String.format("J: Index [%d] must not be >= shape[%d]=%d.", i, i, shape[i]));
              if (shape[i] != 1) {
                  offset += indices[i] * stride[i];
              }
          }
  
          return offset;
      }
docs: Get an offset for retrieval
  from a data buffer
  based on the given
  shape stride and given indices
  @param baseOffset the offset to start from
  @param shape the shape of the array
  @param stride the stride of the array
  @param indices the indices to iterate over
  @return the double at the specified index